Syntax changes in front and back end dirs. These do not affect functionality and are purely intended to better capture and describe the app's functionality and purpose
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
import { useState } from 'react';
|
||||
import NotebookList from './components/NotebookList.jsx';
|
||||
import SourceCorpusList from './components/SourceCorpusList.jsx';
|
||||
import SourcePanel from './components/SourcePanel.jsx';
|
||||
import DocumentButtons from './components/DocumentButtons.jsx';
|
||||
import ChatPanel from './components/ChatPanel.jsx';
|
||||
import DocumentModal from './components/DocumentModal.jsx';
|
||||
import { useNotebook } from './hooks/useNotebook.js';
|
||||
import { useSourceCorpus } from './hooks/useSourceCorpus.js';
|
||||
import { generateDocument } from './api/documents.js';
|
||||
|
||||
function App() {
|
||||
const {
|
||||
notebooks,
|
||||
activeNotebook,
|
||||
selectNotebook,
|
||||
createNotebook,
|
||||
deleteNotebook,
|
||||
} = useNotebook();
|
||||
sourceCorpora,
|
||||
activeSourceCorpus,
|
||||
selectSourceCorpus,
|
||||
createSourceCorpus,
|
||||
deleteSourceCorpus,
|
||||
} = useSourceCorpus();
|
||||
|
||||
const [hoverState, setHoverState] = useState(null);
|
||||
const [sourceCount, setSourceCount] = useState(0);
|
||||
@@ -22,9 +22,9 @@ function App() {
|
||||
const [docModal, setDocModal] = useState({ open: false, type: null, document: null, loading: false });
|
||||
const [chatReady, setChatReady] = useState(false);
|
||||
|
||||
const handleSelectNotebook = (id) => {
|
||||
const handleSelectSourceCorpus = (id) => {
|
||||
setChatReady(false);
|
||||
selectNotebook(id);
|
||||
selectSourceCorpus(id);
|
||||
};
|
||||
|
||||
const handleSourceHover = (val) => {
|
||||
@@ -42,7 +42,7 @@ function App() {
|
||||
setDocModal({ open: true, type, document: null, loading: true });
|
||||
|
||||
try {
|
||||
const res = await generateDocument(activeNotebook.id, type);
|
||||
const res = await generateDocument(activeSourceCorpus.id, type);
|
||||
setDocModal({ open: true, type, document: res.document, loading: false });
|
||||
} catch (err) {
|
||||
console.error('document generation failed', err);
|
||||
@@ -58,17 +58,17 @@ function App() {
|
||||
return (
|
||||
<div className="app">
|
||||
<aside className="sidebar">
|
||||
<NotebookList
|
||||
notebooks={notebooks}
|
||||
activeId={activeNotebook?.id}
|
||||
onSelect={handleSelectNotebook}
|
||||
onCreate={createNotebook}
|
||||
onDelete={deleteNotebook}
|
||||
<SourceCorpusList
|
||||
sourceCorpora={sourceCorpora}
|
||||
activeId={activeSourceCorpus?.id}
|
||||
onSelect={handleSelectSourceCorpus}
|
||||
onCreate={createSourceCorpus}
|
||||
onDelete={deleteSourceCorpus}
|
||||
/>
|
||||
{activeNotebook && (
|
||||
{activeSourceCorpus && (
|
||||
<>
|
||||
<SourcePanel
|
||||
notebookId={activeNotebook.id}
|
||||
sourceCorpusId={activeSourceCorpus.id}
|
||||
hoveredSourceIndex={hoveredDocIndex}
|
||||
onSourceHover={handleSourceHover}
|
||||
onSourcesChange={setSourceCount}
|
||||
@@ -85,16 +85,16 @@ function App() {
|
||||
)}
|
||||
</aside>
|
||||
<main className="main">
|
||||
{activeNotebook ? (
|
||||
{activeSourceCorpus ? (
|
||||
<ChatPanel
|
||||
notebookId={activeNotebook.id}
|
||||
sourceCorpusId={activeSourceCorpus.id}
|
||||
hoveredSource={hoveredInstanceId}
|
||||
hoveredDocIndex={hoveredDocIndex}
|
||||
onSourceHover={handleSourceHover}
|
||||
onFirstResponse={() => setChatReady(true)}
|
||||
/>
|
||||
) : (
|
||||
<p>Select or create a notebook to get started.</p>
|
||||
<p>Select or create a source corpus to get started.</p>
|
||||
)}
|
||||
</main>
|
||||
<DocumentModal
|
||||
|
||||
Reference in New Issue
Block a user