generated from nhcarrigan/template
fix: reconnect bug, don't greet on reconnects #43
@@ -51,8 +51,10 @@
|
|||||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||||
|
|
||||||
await invoke("start_claude", {
|
await invoke("start_claude", {
|
||||||
workingDir: workingDirectory || "/home/naomi",
|
options: {
|
||||||
allowedTools: newGrantedTools,
|
working_dir: workingDirectory || "/home/naomi",
|
||||||
|
allowed_tools: newGrantedTools,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wait for connection to establish
|
// Wait for connection to establish
|
||||||
|
|||||||
+8
-2
@@ -11,6 +11,8 @@ interface StateChangePayload {
|
|||||||
tool_name: string | null;
|
tool_name: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let hasConnectedThisSession = false;
|
||||||
|
|
||||||
function getTimeOfDay(): string {
|
function getTimeOfDay(): string {
|
||||||
const hour = new Date().getHours();
|
const hour = new Date().getHours();
|
||||||
|
|
||||||
@@ -65,12 +67,16 @@ export async function initializeTauriListeners() {
|
|||||||
if (status === "connected") {
|
if (status === "connected") {
|
||||||
claudeStore.addLine("system", "Connected to Claude Code");
|
claudeStore.addLine("system", "Connected to Claude Code");
|
||||||
characterState.setState("idle");
|
characterState.setState("idle");
|
||||||
// Send greeting when connection is established
|
if (!hasConnectedThisSession) {
|
||||||
await sendGreeting();
|
hasConnectedThisSession = true;
|
||||||
|
await sendGreeting();
|
||||||
|
}
|
||||||
} else if (status === "disconnected") {
|
} else if (status === "disconnected") {
|
||||||
|
hasConnectedThisSession = false;
|
||||||
claudeStore.addLine("system", "Disconnected from Claude Code");
|
claudeStore.addLine("system", "Disconnected from Claude Code");
|
||||||
characterState.setState("idle");
|
characterState.setState("idle");
|
||||||
} else if (status === "error") {
|
} else if (status === "error") {
|
||||||
|
hasConnectedThisSession = false;
|
||||||
claudeStore.addLine("error", "Connection error");
|
claudeStore.addLine("error", "Connection error");
|
||||||
characterState.setTemporaryState("error", 3000);
|
characterState.setTemporaryState("error", 3000);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user