fix: fix auto select first artifact
This commit is contained in:
parent
03311d43da
commit
1e2855b533
|
|
@ -74,14 +74,24 @@ export default function ChatPage() {
|
||||||
return result;
|
return result;
|
||||||
}, [thread, isNewThread]);
|
}, [thread, isNewThread]);
|
||||||
|
|
||||||
|
const [autoSelectFirstArtifact, setAutoSelectFirstArtifact] = useState(true);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setArtifacts(thread.values.artifacts);
|
setArtifacts(thread.values.artifacts);
|
||||||
if (env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true") {
|
if (
|
||||||
|
env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true" &&
|
||||||
|
autoSelectFirstArtifact
|
||||||
|
) {
|
||||||
if (thread?.values?.artifacts?.length > 0) {
|
if (thread?.values?.artifacts?.length > 0) {
|
||||||
|
setAutoSelectFirstArtifact(false);
|
||||||
selectArtifact(thread.values.artifacts[0]!);
|
selectArtifact(thread.values.artifacts[0]!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [selectArtifact, setArtifacts, thread.values.artifacts]);
|
}, [
|
||||||
|
autoSelectFirstArtifact,
|
||||||
|
selectArtifact,
|
||||||
|
setArtifacts,
|
||||||
|
thread.values.artifacts,
|
||||||
|
]);
|
||||||
|
|
||||||
const [todoListCollapsed, setTodoListCollapsed] = useState(
|
const [todoListCollapsed, setTodoListCollapsed] = useState(
|
||||||
env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY !== "true",
|
env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY !== "true",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue