From 6c6cd5052a157b658f50e04ca7c350a00c2dbd60 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Fri, 16 Jan 2026 14:17:17 +0800 Subject: feat: add assistant view and configuration editor components Introduced a new AssistantView component for enhanced interaction with the AI assistant, allowing users to send messages and receive responses. Implemented a ConfigEditorModal for editing configuration files with JSON validation and history management. Updated the App component to integrate these new features, improving user experience and functionality in managing AI settings. --- ui/src/components/AssistantView.svelte | 436 +++++++++++++++++++++++++++++++++ 1 file changed, 436 insertions(+) create mode 100644 ui/src/components/AssistantView.svelte (limited to 'ui/src/components/AssistantView.svelte') diff --git a/ui/src/components/AssistantView.svelte b/ui/src/components/AssistantView.svelte new file mode 100644 index 0000000..54509a5 --- /dev/null +++ b/ui/src/components/AssistantView.svelte @@ -0,0 +1,436 @@ + + +
+
+
+
+ +
+
+

Game Assistant

+

Powered by {getProviderName()}

+
+
+ +
+ {#if !settingsState.settings.assistant.enabled} +
+ + Disabled +
+ {:else if !assistantState.isProviderHealthy} +
+ + Offline +
+ {:else} +
+
+ Online +
+ {/if} + + + + + + +
+
+ + +
+ {#if assistantState.messages.length === 0} +
+ +
+

How can I help you today?

+

I can analyze your game logs, diagnose crashes, or explain mod features.

+
+ {#if !settingsState.settings.assistant.enabled} +
+ Assistant is disabled. Enable it in . +
+ {:else if !assistantState.isProviderHealthy} +
+ {getProviderHelpText()} +
+ {/if} +
+ {/if} + +
+ {#each assistantState.messages as msg, idx} +
+ {#if msg.role === 'assistant'} +
+ +
+ {/if} + +
+ {#if msg.role === 'user'} +
+ {msg.content} +
+ {:else} + {@const parsed = parseMessageContent(msg.content)} + + + {#if parsed.thinking} +
+
+ + + Thinking Process + + +
+ {parsed.thinking} + {#if parsed.isThinking} + + {/if} +
+
+
+ {/if} + + +
+ {#if parsed.content} + {@html renderMarkdown(parsed.content)} + {:else if assistantState.isProcessing && idx === assistantState.messages.length - 1 && !parsed.isThinking} + + + + + + {/if} +
+ + + {#if msg.stats} +
+
+ Eval: + {msg.stats.eval_count} tokens +
+
+ Time: + {(msg.stats.total_duration / 1e9).toFixed(2)}s +
+ {#if msg.stats.eval_duration > 0} +
+ Speed: + {(msg.stats.eval_count / (msg.stats.eval_duration / 1e9)).toFixed(1)} t/s +
+ {/if} +
+ {/if} + {/if} +
+
+ {/each} +
+ + +
+
+ + + +
+
+
+
+ + -- cgit v1.2.3-70-g09d2