refactor(frontend): optimize network queries and improve code readability (#919)

* refactor(frontend): optimize network queries and improve code readability
- useThreadStream: Add useStream with fetchStateHistory: {limit: 1}
- useThreads: Add select fields and disable refetchOnWindowFocus
- useModels: Disable refetchOnWindowFocus
- ChatPage and titleOfThread: Improve thread title logic
- loadModels: Refactor code for better readability

* fix: address the review comments of Copilot

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Zhiyunyao
2026-03-02 20:35:46 +08:00
committed by GitHub
parent a2f91c7594
commit 72df234636
5 changed files with 15 additions and 29 deletions
+1 -4
View File
@@ -17,8 +17,5 @@ export function textOfMessage(message: BaseMessage) {
}
export function titleOfThread(thread: AgentThread) {
if (thread.values && "title" in thread.values) {
return thread.values.title;
}
return "Untitled";
return thread.values?.title ?? "Untitled";
}