fix: Remove the mutual exclusivity between "persona selection" and "driving model selection."

This commit is contained in:
charm-ch
2026-06-25 14:44:46 +08:00
committed by zyairehhh
parent 66bf0e5cd5
commit c112faccac
2 changed files with 12 additions and 6 deletions

View File

@@ -2739,12 +2739,6 @@ export default function App() {
const handleModelChange = useCallback((newModel: string) => {
clearSubtitleState();
setSelectedPersonaId("");
try {
window.localStorage.removeItem(SELECTED_PERSONA_STORAGE_KEY);
} catch {
/* ignore */
}
setModel(newModel);
void (async () => {
const sid = sessionIdRef.current;

View File

@@ -15,3 +15,15 @@ def test_frontend_prefers_backend_default_model_before_avatar_model() -> None:
assert default_idx < avatar_idx
assert "mo.default_model" in source
def test_frontend_keeps_persona_selected_when_model_changes() -> None:
source = Path("apps/web/src/App.tsx").read_text(encoding="utf-8")
start = source.index(" const handleModelChange = useCallback((newModel: string) => {")
end = source.index(" }, [clearSubtitleState, releaseSession, resetLiveState]);", start)
block = source[start:end]
assert 'setSelectedPersonaId("")' not in block
assert 'window.localStorage.removeItem(SELECTED_PERSONA_STORAGE_KEY)' not in block
assert 'clearSubtitleState();' in block
assert 'setModel(newModel);' in block