222
This commit is contained in:
1 parent
ebe1678b30
commit
b152cb43fc
2 files changed
+10
-2
No files matched your search
@@ -165,7 +165,7 @@ export function WorkspaceNavChatList({
|
|||||||
)}
|
)}
|
||||||
</SidebarMenu>
|
</SidebarMenu>
|
||||||
</SidebarGroup>
|
</SidebarGroup>
|
||||||
{/* {!showCollapseTrigger && <WorkspaceNavStudio />} */}
|
{!showCollapseTrigger && <WorkspaceNavStudio />}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useRef, useState } from "react";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import {
|
import {
|
||||||
AlignLeft,
|
AlignLeft,
|
||||||
@@ -191,6 +191,7 @@ export default function StudioNotebookDetailPage() {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const [sourcesOpen, setSourcesOpen] = useState(false);
|
const [sourcesOpen, setSourcesOpen] = useState(false);
|
||||||
const [selectedSourceIds, setSelectedSourceIds] = useState<number[]>([]);
|
const [selectedSourceIds, setSelectedSourceIds] = useState<number[]>([]);
|
||||||
|
const sourcesInitializedRef = useRef(false);
|
||||||
const [selectedModel, setSelectedModel] = useState<string>("");
|
const [selectedModel, setSelectedModel] = useState<string>("");
|
||||||
const [input, setInput] = useState("");
|
const [input, setInput] = useState("");
|
||||||
// null = 显示历史线程列表;string = 显示该线程的聊天
|
// null = 显示历史线程列表;string = 显示该线程的聊天
|
||||||
@@ -208,6 +209,13 @@ export default function StudioNotebookDetailPage() {
|
|||||||
const notebook = notebooks.find((nb) => nb.id === Number(notebookId));
|
const notebook = notebooks.find((nb) => nb.id === Number(notebookId));
|
||||||
|
|
||||||
const { sources, isLoading: isLoadingSources } = useNotebookSources(notebook?.id ?? null);
|
const { sources, isLoading: isLoadingSources } = useNotebookSources(notebook?.id ?? null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (sources.length > 0 && !sourcesInitializedRef.current) {
|
||||||
|
sourcesInitializedRef.current = true;
|
||||||
|
setSelectedSourceIds(sources.map((s) => s.id));
|
||||||
|
}
|
||||||
|
}, [sources]);
|
||||||
const citationRehypePlugins = useMemo(() => {
|
const citationRehypePlugins = useMemo(() => {
|
||||||
const mapped = sources.map((s) => ({
|
const mapped = sources.map((s) => ({
|
||||||
id: s.id,
|
id: s.id,
|
||||||
|
|||||||
Reference in new issue
Block a user