fix(frontend): persist model selection per thread (#1553)

* fix(frontend): persist model selection per thread

* fix(frontend): apply thread model override on fallback

* refactor(frontend): split thread settings hook

* fix frontend local storage guards
This commit is contained in:
Admire
2026-04-01 23:27:03 +08:00
committed by GitHub
parent 0a379602b8
commit 0eb6550cf4
4 changed files with 133 additions and 44 deletions
@@ -20,7 +20,7 @@ import { Tooltip } from "@/components/workspace/tooltip";
import { useAgent } from "@/core/agents";
import { useI18n } from "@/core/i18n/hooks";
import { useNotification } from "@/core/notification/hooks";
import { useLocalSettings } from "@/core/settings";
import { useThreadSettings } from "@/core/settings";
import { useThreadStream } from "@/core/threads/hooks";
import { textOfMessage } from "@/core/threads/utils";
import { env } from "@/env";
@@ -28,7 +28,6 @@ import { cn } from "@/lib/utils";
export default function AgentChatPage() {
const { t } = useI18n();
const [settings, setSettings] = useLocalSettings();
const router = useRouter();
const { agent_name } = useParams<{
@@ -38,6 +37,7 @@ export default function AgentChatPage() {
const { agent } = useAgent(agent_name);
const { threadId, isNewThread, setIsNewThread } = useThreadChat();
const [settings, setSettings] = useThreadSettings(threadId);
const { showNotification } = useNotification();
const [thread, sendMessage] = useThreadStream({
@@ -19,7 +19,7 @@ import { TokenUsageIndicator } from "@/components/workspace/token-usage-indicato
import { Welcome } from "@/components/workspace/welcome";
import { useI18n } from "@/core/i18n/hooks";
import { useNotification } from "@/core/notification/hooks";
import { useLocalSettings } from "@/core/settings";
import { useThreadSettings } from "@/core/settings";
import { useThreadStream } from "@/core/threads/hooks";
import { textOfMessage } from "@/core/threads/utils";
import { env } from "@/env";
@@ -27,9 +27,8 @@ import { cn } from "@/lib/utils";
export default function ChatPage() {
const { t } = useI18n();
const [settings, setSettings] = useLocalSettings();
const { threadId, isNewThread, setIsNewThread, isMock } = useThreadChat();
const [settings, setSettings] = useThreadSettings(threadId);
useSpecificChatMode();
const { showNotification } = useNotification();