generated from nhcarrigan/template
feat/tabs #47
@@ -192,8 +192,8 @@
|
||||
{conversation.name}
|
||||
</span>
|
||||
{#if id !== activeConversationId && id === connectedConversationId}
|
||||
<span class="text-xs text-[var(--text-tertiary)]" title="This tab has the active Claude connection">
|
||||
(active)
|
||||
<span class="text-xs text-[var(--text-tertiary)]" title="This tab has the Claude connection">
|
||||
(connected)
|
||||
</span>
|
||||
{/if}
|
||||
{#if hasUnreadMessages(id, conversation)}
|
||||
@@ -233,7 +233,7 @@
|
||||
<button
|
||||
onclick={createNewTab}
|
||||
class="new-tab-btn flex items-center justify-center w-7 h-7 rounded hover:bg-[var(--bg-tertiary)] text-[var(--text-secondary)] transition-colors"
|
||||
title="New conversation (Ctrl+T) Note: Only one tab can be connected at a time"
|
||||
title="New conversation (Ctrl+T)"
|
||||
>
|
||||
<svg
|
||||
class="w-4 h-4"
|
||||
|
||||
@@ -46,8 +46,6 @@
|
||||
let messageToSend = formattedMessage;
|
||||
if (getShouldRestoreHistory()) {
|
||||
const savedHistory = getSavedHistory();
|
||||
console.log("Should restore history:", true);
|
||||
console.log("Saved history:", savedHistory);
|
||||
|
||||
if (savedHistory) {
|
||||
// Prepend the conversation history with a context message
|
||||
@@ -57,13 +55,9 @@ ${savedHistory}
|
||||
[Continuing conversation after reconnection:]
|
||||
User: ${formattedMessage}`;
|
||||
|
||||
console.log("Message with history:", messageToSend);
|
||||
|
||||
// Clear the restoration flags
|
||||
clearHistoryRestore();
|
||||
}
|
||||
} else {
|
||||
console.log("Should restore history:", false);
|
||||
}
|
||||
|
||||
// Reset notification state for new user message
|
||||
@@ -93,14 +87,10 @@ User: ${formattedMessage}`;
|
||||
async function handleInterrupt() {
|
||||
// Save the conversation history FIRST before anything else
|
||||
const history = claudeStore.getConversationHistory();
|
||||
console.log("Saving conversation history:", history);
|
||||
|
||||
if (history) {
|
||||
setSavedHistory(history);
|
||||
setShouldRestoreHistory(true);
|
||||
console.log("History saved and restoration flag set");
|
||||
} else {
|
||||
console.log("No history to save");
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -199,34 +199,6 @@ function createConversationsStore() {
|
||||
characterState.setState(targetConv.characterState);
|
||||
}
|
||||
|
||||
// Auto-reconnect logic
|
||||
if (targetConv && targetConv.connectionStatus === "disconnected") {
|
||||
// Check if another conversation is connected
|
||||
let hasConnectedConv = false;
|
||||
for (const [convId, conv] of convs) {
|
||||
if (convId !== id && (conv.connectionStatus === "connected" || conv.connectionStatus === "connecting")) {
|
||||
hasConnectedConv = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasConnectedConv) {
|
||||
// Add a note about the limitation
|
||||
const lineId = generateLineId();
|
||||
conversations.update((c) => {
|
||||
const conv = c.get(id);
|
||||
if (conv) {
|
||||
conv.terminalLines.push({
|
||||
id: lineId,
|
||||
type: "system",
|
||||
content: "Another tab is connected. Disconnect it first or use that tab.",
|
||||
timestamp: new Date(),
|
||||
});
|
||||
}
|
||||
return c;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -4,26 +4,21 @@ let savedHistory: string | null = null;
|
||||
|
||||
export function setShouldRestoreHistory(should: boolean) {
|
||||
shouldRestore = should;
|
||||
console.log("Setting shouldRestoreHistory to:", should);
|
||||
}
|
||||
|
||||
export function setSavedHistory(history: string | null) {
|
||||
savedHistory = history;
|
||||
console.log("Setting savedHistory, length:", history?.length || 0);
|
||||
}
|
||||
|
||||
export function getShouldRestoreHistory(): boolean {
|
||||
console.log("Getting shouldRestoreHistory:", shouldRestore);
|
||||
return shouldRestore;
|
||||
}
|
||||
|
||||
export function getSavedHistory(): string | null {
|
||||
console.log("Getting savedHistory, length:", savedHistory?.length || 0);
|
||||
return savedHistory;
|
||||
}
|
||||
|
||||
export function clearHistoryRestore() {
|
||||
console.log("Clearing history restore flags");
|
||||
shouldRestore = false;
|
||||
savedHistory = null;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ const messageModeStore = writable<string>("chat");
|
||||
export const messageMode = {
|
||||
subscribe: messageModeStore.subscribe,
|
||||
set: (mode: string) => {
|
||||
console.log("Setting message mode to:", mode);
|
||||
messageModeStore.set(mode);
|
||||
},
|
||||
reset: () => messageModeStore.set("chat"),
|
||||
|
||||
@@ -225,14 +225,6 @@ export async function initializeTauriListeners() {
|
||||
const outputUnlisten = await listen<OutputPayload>("claude:output", (event) => {
|
||||
const { line_type, content, tool_name, conversation_id } = event.payload;
|
||||
|
||||
// Debug log
|
||||
const activeId = get(claudeStore.activeConversationId);
|
||||
console.log("claude:output event", {
|
||||
conversation_id,
|
||||
activeConversationId: activeId,
|
||||
line_type,
|
||||
content: content.substring(0, 50) + "...",
|
||||
});
|
||||
|
||||
// Always store the output to the correct conversation
|
||||
if (conversation_id) {
|
||||
@@ -308,8 +300,6 @@ export async function initializeTauriListeners() {
|
||||
}
|
||||
});
|
||||
unlisteners.push(permissionUnlisten);
|
||||
|
||||
console.log("Tauri event listeners initialized");
|
||||
}
|
||||
|
||||
export function cleanupTauriListeners() {
|
||||
@@ -319,6 +309,4 @@ export function cleanupTauriListeners() {
|
||||
|
||||
// Cleanup notification rules
|
||||
cleanupNotificationRules();
|
||||
|
||||
console.log("Tauri event listeners cleaned up");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user