generated from nhcarrigan/template
chore: linter
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
setSavedHistory,
|
setSavedHistory,
|
||||||
getShouldRestoreHistory,
|
getShouldRestoreHistory,
|
||||||
getSavedHistory,
|
getSavedHistory,
|
||||||
clearHistoryRestore
|
clearHistoryRestore,
|
||||||
} from "$lib/stores/historyRestore";
|
} from "$lib/stores/historyRestore";
|
||||||
import MessageModeSelector from "$lib/components/MessageModeSelector.svelte";
|
import MessageModeSelector from "$lib/components/MessageModeSelector.svelte";
|
||||||
import { getCurrentMode } from "$lib/stores/messageMode";
|
import { getCurrentMode } from "$lib/stores/messageMode";
|
||||||
@@ -115,8 +115,8 @@ User: ${formattedMessage}`;
|
|||||||
// Reconnect to Claude
|
// Reconnect to Claude
|
||||||
await invoke("start_claude", {
|
await invoke("start_claude", {
|
||||||
options: {
|
options: {
|
||||||
working_dir: workingDir
|
working_dir: workingDir,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
} catch (reconnectError) {
|
} catch (reconnectError) {
|
||||||
console.error("Failed to auto-reconnect:", reconnectError);
|
console.error("Failed to auto-reconnect:", reconnectError);
|
||||||
@@ -124,7 +124,6 @@ User: ${formattedMessage}`;
|
|||||||
claudeStore.addLine("system", "Please manually reconnect to continue");
|
claudeStore.addLine("system", "Please manually reconnect to continue");
|
||||||
}
|
}
|
||||||
}, 500); // Brief delay to ensure process is fully terminated
|
}, 500); // Brief delay to ensure process is fully terminated
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to interrupt:", error);
|
console.error("Failed to interrupt:", error);
|
||||||
claudeStore.addLine("error", `Failed to interrupt: ${error}`);
|
claudeStore.addLine("error", `Failed to interrupt: ${error}`);
|
||||||
@@ -145,47 +144,47 @@ User: ${formattedMessage}`;
|
|||||||
|
|
||||||
<div class="input-row flex gap-3 items-end">
|
<div class="input-row flex gap-3 items-end">
|
||||||
<div class="flex-1 relative">
|
<div class="flex-1 relative">
|
||||||
<textarea
|
<textarea
|
||||||
bind:value={inputValue}
|
bind:value={inputValue}
|
||||||
onkeydown={handleKeyDown}
|
onkeydown={handleKeyDown}
|
||||||
placeholder={isConnected ? "Ask Hikari anything..." : "Connect to Claude first..."}
|
placeholder={isConnected ? "Ask Hikari anything..." : "Connect to Claude first..."}
|
||||||
disabled={!isConnected || isSubmitting}
|
disabled={!isConnected || isSubmitting}
|
||||||
rows={1}
|
rows={1}
|
||||||
class="w-full px-4 py-3 bg-[var(--bg-secondary)] border border-[var(--border-color)]
|
class="w-full px-4 py-3 bg-[var(--bg-secondary)] border border-[var(--border-color)]
|
||||||
rounded-lg text-[var(--text-primary)] placeholder-gray-500 resize-none
|
rounded-lg text-[var(--text-primary)] placeholder-gray-500 resize-none
|
||||||
focus:outline-none focus:border-[var(--accent-primary)] focus:ring-1 focus:ring-[var(--accent-primary)]
|
focus:outline-none focus:border-[var(--accent-primary)] focus:ring-1 focus:ring-[var(--accent-primary)]
|
||||||
disabled:opacity-50 disabled:cursor-not-allowed
|
disabled:opacity-50 disabled:cursor-not-allowed
|
||||||
transition-all duration-200"
|
transition-all duration-200"
|
||||||
></textarea>
|
></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if isProcessing}
|
{#if isProcessing}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={handleInterrupt}
|
onclick={handleInterrupt}
|
||||||
class="px-6 py-3 bg-red-600 hover:bg-red-700
|
class="px-6 py-3 bg-red-600 hover:bg-red-700
|
||||||
text-white font-medium rounded-lg
|
text-white font-medium rounded-lg
|
||||||
transition-all duration-200 transform hover:scale-105 active:scale-95"
|
transition-all duration-200 transform hover:scale-105 active:scale-95"
|
||||||
title="Interrupt the current response (Ctrl+C)"
|
title="Interrupt the current response (Ctrl+C)"
|
||||||
>
|
>
|
||||||
<span class="font-bold">β </span> Stop
|
<span class="font-bold">β </span> Stop
|
||||||
</button>
|
</button>
|
||||||
{:else}
|
{:else}
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={!isConnected || isSubmitting || !inputValue.trim()}
|
disabled={!isConnected || isSubmitting || !inputValue.trim()}
|
||||||
class="px-6 py-3 bg-[var(--accent-primary)] hover:bg-[var(--accent-secondary)]
|
class="px-6 py-3 bg-[var(--accent-primary)] hover:bg-[var(--accent-secondary)]
|
||||||
text-white font-medium rounded-lg
|
text-white font-medium rounded-lg
|
||||||
disabled:opacity-50 disabled:cursor-not-allowed
|
disabled:opacity-50 disabled:cursor-not-allowed
|
||||||
transition-all duration-200 transform hover:scale-105 active:scale-95"
|
transition-all duration-200 transform hover:scale-105 active:scale-95"
|
||||||
>
|
>
|
||||||
{#if isSubmitting}
|
{#if isSubmitting}
|
||||||
<span class="inline-block animate-spin">β³</span>
|
<span class="inline-block animate-spin">β³</span>
|
||||||
{:else}
|
{:else}
|
||||||
Send
|
Send
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { MESSAGE_MODES, type MessageMode } from '$lib/types/messageMode';
|
import { MESSAGE_MODES, type MessageMode } from "$lib/types/messageMode";
|
||||||
import { messageMode } from '$lib/stores/messageMode';
|
import { messageMode } from "$lib/stores/messageMode";
|
||||||
|
|
||||||
let currentMode = $state('chat');
|
let currentMode = $state("chat");
|
||||||
let isOpen = $state(false);
|
let isOpen = $state(false);
|
||||||
|
|
||||||
messageMode.subscribe(mode => {
|
messageMode.subscribe((mode) => {
|
||||||
currentMode = mode;
|
currentMode = mode;
|
||||||
});
|
});
|
||||||
|
|
||||||
let selectedMode = $derived(MESSAGE_MODES.find(m => m.id === currentMode) || MESSAGE_MODES[0]);
|
let selectedMode = $derived(MESSAGE_MODES.find((m) => m.id === currentMode) || MESSAGE_MODES[0]);
|
||||||
|
|
||||||
function selectMode(mode: MessageMode) {
|
function selectMode(mode: MessageMode) {
|
||||||
messageMode.set(mode.id);
|
messageMode.set(mode.id);
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close dropdown when clicking outside
|
// Close dropdown when clicking outside
|
||||||
function handleClickOutside(event: MouseEvent) {
|
function handleClickOutside() {
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
isOpen = false;
|
isOpen = false;
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
{#if isOpen}
|
{#if isOpen}
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
{#each MESSAGE_MODES as mode}
|
{#each MESSAGE_MODES as mode (mode.id)}
|
||||||
<button
|
<button
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
class:active={mode.id === currentMode}
|
class:active={mode.id === currentMode}
|
||||||
@@ -154,4 +154,4 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -153,7 +153,9 @@ export const isClaudeProcessing = derived(
|
|||||||
[claudeStore.connectionStatus, characterState],
|
[claudeStore.connectionStatus, characterState],
|
||||||
([$connectionStatus, $characterState]) => {
|
([$connectionStatus, $characterState]) => {
|
||||||
// Must be connected and in one of the processing states
|
// Must be connected and in one of the processing states
|
||||||
return $connectionStatus === "connected" &&
|
return (
|
||||||
["thinking", "typing", "searching", "coding", "mcp"].includes($characterState);
|
$connectionStatus === "connected" &&
|
||||||
|
["thinking", "typing", "searching", "coding", "mcp"].includes($characterState)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -26,4 +26,4 @@ export function clearHistoryRestore() {
|
|||||||
console.log("Clearing history restore flags");
|
console.log("Clearing history restore flags");
|
||||||
shouldRestore = false;
|
shouldRestore = false;
|
||||||
savedHistory = null;
|
savedHistory = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
// Default to chat mode
|
// Default to chat mode
|
||||||
const messageModeStore = writable<string>('chat');
|
const messageModeStore = writable<string>("chat");
|
||||||
|
|
||||||
export const messageMode = {
|
export const messageMode = {
|
||||||
subscribe: messageModeStore.subscribe,
|
subscribe: messageModeStore.subscribe,
|
||||||
set: (mode: string) => {
|
set: (mode: string) => {
|
||||||
console.log('Setting message mode to:', mode);
|
console.log("Setting message mode to:", mode);
|
||||||
messageModeStore.set(mode);
|
messageModeStore.set(mode);
|
||||||
},
|
},
|
||||||
reset: () => messageModeStore.set('chat')
|
reset: () => messageModeStore.set("chat"),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper to get current mode
|
// Helper to get current mode
|
||||||
export function getCurrentMode(): string {
|
export function getCurrentMode(): string {
|
||||||
let currentMode = 'chat';
|
let currentMode = "chat";
|
||||||
messageMode.subscribe(mode => currentMode = mode)();
|
messageMode.subscribe((mode) => (currentMode = mode))();
|
||||||
return currentMode;
|
return currentMode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,50 +8,50 @@ export interface MessageMode {
|
|||||||
|
|
||||||
export const MESSAGE_MODES: MessageMode[] = [
|
export const MESSAGE_MODES: MessageMode[] = [
|
||||||
{
|
{
|
||||||
id: 'chat',
|
id: "chat",
|
||||||
name: 'Chat',
|
name: "Chat",
|
||||||
description: 'Normal conversation mode',
|
description: "Normal conversation mode",
|
||||||
icon: 'π¬'
|
icon: "π¬",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'architect',
|
id: "architect",
|
||||||
name: 'Architect',
|
name: "Architect",
|
||||||
description: 'High-level design and architecture planning',
|
description: "High-level design and architecture planning",
|
||||||
prefix: '[Architect Mode] ',
|
prefix: "[Architect Mode] ",
|
||||||
icon: 'ποΈ'
|
icon: "ποΈ",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'code',
|
id: "code",
|
||||||
name: 'Code',
|
name: "Code",
|
||||||
description: 'Focused on writing and editing code',
|
description: "Focused on writing and editing code",
|
||||||
prefix: '[Code Mode] ',
|
prefix: "[Code Mode] ",
|
||||||
icon: 'π»'
|
icon: "π»",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'debug',
|
id: "debug",
|
||||||
name: 'Debug',
|
name: "Debug",
|
||||||
description: 'Help with debugging and troubleshooting',
|
description: "Help with debugging and troubleshooting",
|
||||||
prefix: '[Debug Mode] ',
|
prefix: "[Debug Mode] ",
|
||||||
icon: 'π'
|
icon: "π",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'ask',
|
id: "ask",
|
||||||
name: 'Ask',
|
name: "Ask",
|
||||||
description: 'Technical questions and explanations',
|
description: "Technical questions and explanations",
|
||||||
prefix: '[Ask Mode] ',
|
prefix: "[Ask Mode] ",
|
||||||
icon: 'β'
|
icon: "β",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'review',
|
id: "review",
|
||||||
name: 'Review',
|
name: "Review",
|
||||||
description: 'Code review and feedback',
|
description: "Code review and feedback",
|
||||||
prefix: '[Review Mode] ',
|
prefix: "[Review Mode] ",
|
||||||
icon: 'π'
|
icon: "π",
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export function getMessageMode(id: string): MessageMode | undefined {
|
export function getMessageMode(id: string): MessageMode | undefined {
|
||||||
return MESSAGE_MODES.find(mode => mode.id === id);
|
return MESSAGE_MODES.find((mode) => mode.id === id);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatMessageWithMode(message: string, modeId: string): string {
|
export function formatMessageWithMode(message: string, modeId: string): string {
|
||||||
@@ -66,4 +66,4 @@ export function formatMessageWithMode(message: string, modeId: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return mode.prefix + message;
|
return mode.prefix + message;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user