Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(workbench): per-session initial-message guard + clearable agent model

cyh44f165d405ae
diff --git a/ui/src/components/workbench/AgentsPage.tsx b/ui/src/components/workbench/AgentsPage.tsx
index 64ff4121b..ca127b2e0 100644
--- a/ui/src/components/workbench/AgentsPage.tsx
+++ b/ui/src/components/workbench/AgentsPage.tsx
@@ -46,6 +46,9 @@ const BACKEND_ICON_CLASS: Record<Backend, string> = {
};
const EFFORT_OPTIONS = ['low', 'medium', 'high', 'max'];
+// Sentinel option that clears the model override back to the backend default
+// (a combobox can't submit an empty value, so this is the explicit clear path).
+const MODEL_DEFAULT_OPTION = '__default__';
function isSystemAgent(agent: { source: string }): boolean {
return agent.source === 'builtin' || agent.source === 'system';
@@ -709,14 +712,18 @@ const AgentDetailPanel: React.FC<DetailProps> = ({ agent, isDefault, onChange, o
</div>
</Field>
- {/* Model — Combobox with chevron + searchable + custom values. */}
+ {/* Model — Combobox with chevron + searchable + custom values. The
+ leading "backend default" option lets the user clear the override
+ back to model: null (a combobox can't otherwise submit an empty
+ value, so picking it is the only clear path). */}
<Field label={t('agents.detail.model')}>
<Combobox
- options={modelOptions}
+ options={[{ value: MODEL_DEFAULT_OPTION, label: t('agents.detail.modelDefault') }, ...modelOptions]}
value={model}
onValueChange={(next) => {
- setModel(next);
- onChange({ model: next.trim() || null });
+ const value = next === MODEL_DEFAULT_OPTION ? '' : next;
+ setModel(value);
+ onChange({ model: value.trim() || null });
}}
placeholder={t('agents.detail.modelPlaceholder')}
emptyText={t('agents.detail.modelEmpty')}
diff --git a/ui/src/components/workbench/ChatPage.tsx b/ui/src/components/workbench/ChatPage.tsx
index 7264a2d8b..2408f0cd3 100644
--- a/ui/src/components/workbench/ChatPage.tsx
+++ b/ui/src/components/workbench/ChatPage.tsx
@@ -40,9 +40,11 @@ export const ChatPage: React.FC = () => {
const [streamChunks, setStreamChunks] = useState<PendingChunk[]>([]);
const [composing, setComposing] = useState(false);
- // Guards the one-shot replay of a message handed off from the Workbench
- // canvas (see the initial-message effect below).
- const initialMessageSentRef = useRef(false);
+ // Tracks which session's handed-off initial message we've already replayed
+ // (see the initial-message effect below). Keyed by session id, not a global
+ // boolean, so a second create-via-chat flow that reuses this ChatPage
+ // instance (React Router swaps only the :sessionId) still fires.
+ const initialHandledSessionRef = useRef<string | null>(null);
const refresh = useCallback(async () => {
if (!sessionId) return;
@@ -178,12 +180,13 @@ export const ChatPage: React.FC = () => {
// page refresh (which preserves history state) doesn't resend it.
useEffect(() => {
const initialMessage = (location.state as { initialMessage?: string } | null)?.initialMessage;
- if (!initialMessage || initialMessageSentRef.current) return;
+ if (!initialMessage || !sessionId) return;
+ if (initialHandledSessionRef.current === sessionId) return;
if (loading || !session) return;
- initialMessageSentRef.current = true;
+ initialHandledSessionRef.current = sessionId;
navigate(location.pathname, { replace: true, state: null });
void sendMessage(initialMessage);
- }, [location.state, location.pathname, loading, session, navigate, sendMessage]);
+ }, [location.state, location.pathname, loading, session, sessionId, navigate, sendMessage]);
const patch = useCallback(
async (changes: Partial<WorkbenchSession>) => {
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 15af246f4..93165291f 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -1268,6 +1268,7 @@
"model": "Model",
"modelPlaceholder": "Pick or type a model",
"modelEmpty": "No matches — you can type a custom value.",
+ "modelDefault": "Backend default",
"effort": "Reasoning effort",
"systemPrompt": "System prompt",
"systemPromptCount": "~{{count}} tokens",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 6fd46906b..e8542deb7 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -1267,6 +1267,7 @@
"model": "模型",
"modelPlaceholder": "选择或输入模型",
"modelEmpty": "找不到匹配的模型,可以直接输入。",
+ "modelDefault": "使用后端默认",
"effort": "推理强度",
"systemPrompt": "系统提示词",
"systemPromptCount": "~{{count}} tokens",