fix(webui): preserve hero model preset on chat creation

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-04 10:41:01 +08:00
1 parent b04aeeac0e
commit 3d40ed8f76
5 files changed
+43 -7

No files matched your search

+8 -2
View File
@@ -1477,10 +1477,14 @@ function Shell({
[activeChatId, activeChatRunning, activeKey, client, temporaryChatActive],
);
const onCreateChat = useCallback(async (workspaceScope?: WorkspaceScopePayload | null) => {
const onCreateChat = useCallback(async (
workspaceScope?: WorkspaceScopePayload | null,
_initialMessage?: string,
modelPreset?: string | null,
) => {
try {
const scope = workspaceScope ?? activeWorkspaceScope;
const chatId = await createChat(scope);
const chatId = await createChat(scope, modelPreset);
const key = `websocket:${chatId}`;
pendingCreatedSessionKeyRef.current = key;
navigate({
@@ -1509,6 +1513,7 @@ function Shell({
async (
workspaceScope?: WorkspaceScopePayload | null,
initialMessage?: string,
modelPreset?: string | null,
) => {
try {
const chatId = await client.newTemporaryChat();
@@ -1519,6 +1524,7 @@ function Shell({
const nextSession: ChatSummary = {
...session,
preview: initialMessage ?? "",
modelPreset: modelPreset ?? null,
...(restrictedScope ? { workspaceScope: restrictedScope } : {}),
};
setTemporarySessions((current) => ({