Centralize AI configuration into generic AE_AITools component
- Enhanced AE_AITools with a Settings tab for model, prompt, and parameter configuration. - Connected AE_AITools to Journals state via two-way bindings for persistent configuration. - Removed redundant AI settings from Journals config modal. - Standardized Svelte 5 patterns for cross-module component configuration.
This commit is contained in:
@@ -1718,10 +1718,18 @@
|
||||
content={tmp_entry_obj.content}
|
||||
bind:summary={tmp_entry_obj.summary}
|
||||
onSave={update_journal_entry}
|
||||
token={$journals_loc?.llm__api_token}
|
||||
baseUrl={$journals_loc?.llm__api_base_url}
|
||||
model={$journals_loc?.llm__api_model}
|
||||
systemPrompt={$journals_loc?.entry?.llm__system_prompt}
|
||||
bind:token={$journals_loc.llm__api_token}
|
||||
bind:baseUrl={$journals_loc.llm__api_base_url}
|
||||
bind:model={$journals_loc.llm__api_model}
|
||||
bind:systemPrompt={$journals_loc.entry.llm__system_prompt}
|
||||
bind:maxTokens={$journals_loc.entry.llm__max_tokens}
|
||||
bind:temperature={$journals_loc.entry.llm__temperature}
|
||||
onSyncConfig={() => {
|
||||
$journals_loc.llm__api_base_url = $ae_loc.site_cfg_json?.llm__api_base_url ?? 'https://ai.dgrzone.com/api';
|
||||
$journals_loc.llm__api_model = $ae_loc.site_cfg_json?.llm__api_model ?? 'dgrzone-deepseek-8b-quick';
|
||||
$journals_loc.llm__api_token = $ae_loc.site_cfg_json?.llm__api_token ?? '';
|
||||
$journals_loc.entry.llm__system_prompt = $ae_loc.site_cfg_json?.llm__system_prompt ?? '';
|
||||
}}
|
||||
{log_lvl}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -202,131 +202,6 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="w-full space-y-4">
|
||||
<h2 class="h2 text-xl font-bold flex items-center gap-2 border-b border-surface-500/30 pb-2">
|
||||
<Bot class="text-primary-500" />
|
||||
AI Summary Configuration
|
||||
</h2>
|
||||
|
||||
<div class="space-y-4 bg-surface-500/5 p-4 rounded-lg">
|
||||
<button
|
||||
type="button"
|
||||
class="btn variant-ghost-primary w-full md:w-auto"
|
||||
onclick={() => {
|
||||
$journals_loc.llm__api_base_url =
|
||||
$ae_loc.site_cfg_json?.llm__api_base_url ??
|
||||
'https://ai.dgrzone.com/api';
|
||||
$journals_loc.llm__api_model =
|
||||
$ae_loc.site_cfg_json?.llm__api_model ??
|
||||
'dgrzone-deepseek-8b-quick';
|
||||
$journals_loc.llm__api_token =
|
||||
$ae_loc.site_cfg_json?.llm__api_token ?? '';
|
||||
$journals_loc.llm__api_dangerous_browser =
|
||||
$ae_loc.site_cfg_json?.llm__api_dangerous_browser ?? false;
|
||||
$journals_loc.entry.llm__system_prompt =
|
||||
$ae_loc.site_cfg_json?.llm__system_prompt ?? '';
|
||||
}}
|
||||
>
|
||||
<Copy size="1em" class="mr-2" />
|
||||
Sync from Site Configuration
|
||||
</button>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<label class="label">
|
||||
<span>LLM API Base URL</span>
|
||||
<input
|
||||
type="text"
|
||||
bind:value={$journals_loc.llm__api_base_url}
|
||||
placeholder="https://..."
|
||||
class="input"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="label">
|
||||
<span>LLM Model</span>
|
||||
<input
|
||||
type="text"
|
||||
bind:value={$journals_loc.llm__api_model}
|
||||
class="input"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label class="label">
|
||||
<span>LLM API Token</span>
|
||||
<input
|
||||
type="password"
|
||||
bind:value={$journals_loc.llm__api_token}
|
||||
class="input font-mono"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="w-full space-y-2 p-2 border-t border-surface-100-900">
|
||||
<h2 class="font-semibold">$journals_loc?.entry:</h2>
|
||||
|
||||
<!-- entry > ai__system_prompt - textarea -->
|
||||
<!-- <div class="h-16"> -->
|
||||
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- entry > llm__max_tokens - number -->
|
||||
<label class="flex items-center justify-start gap-1">
|
||||
LLM Max Tokens:
|
||||
<input
|
||||
type="number"
|
||||
bind:value={$journals_loc.entry.llm__max_tokens}
|
||||
placeholder="LLM Max Tokens"
|
||||
class="input input-sm input-bordered w-full max-w-xs"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<!-- entry > llm__temperature - number -->
|
||||
<label class="flex items-center justify-start gap-1">
|
||||
LLM Temperature:
|
||||
<input
|
||||
type="number"
|
||||
step="0.01"
|
||||
min="0"
|
||||
max="1"
|
||||
bind:value={$journals_loc.entry.llm__temperature}
|
||||
placeholder="LLM Temperature"
|
||||
class="input input-sm input-bordered w-full max-w-xs"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="flex flex-col items-start justify-start gap-1 h-24">
|
||||
LLM System Prompt for Journal Entry summarization:
|
||||
<E_app_codemirror_v5
|
||||
editable={true}
|
||||
readonly={false}
|
||||
content={$journals_loc?.entry?.llm__system_prompt}
|
||||
bind:new_content={$journals_loc.entry.llm__system_prompt}
|
||||
show_line_numbers={false}
|
||||
placeholder="LLM System Prompt"
|
||||
class="
|
||||
p-1
|
||||
preset-outlined-success-400-600
|
||||
shadow-lg rounded-lg
|
||||
"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm preset-outlined-primary-400-600"
|
||||
onclick={() => {
|
||||
let default_system_prompt =
|
||||
'Summarize the following journal entry content in a concise manner, focusing on key points and insights.';
|
||||
$journals_loc.entry.llm__system_prompt = default_system_prompt;
|
||||
}}
|
||||
>
|
||||
<RefreshCcw class="inline-block mr-1" />
|
||||
Reset to Journal Entry System Prompt
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Section for viewing (and direct editing???) the raw localStorage JSON configuration -->
|
||||
|
||||
Reference in New Issue
Block a user