feat: several models for the assistant, each with its own name, kind, address and key; a model menu in the chat when there are several (or always, from Аккаунт › Вид), the choice kept for the user
This commit is contained in:
1 parent
ded86e1c3f
commit
983809714b
12 files changed
+411
-44
No files matched your search
@@ -152,15 +152,40 @@
|
||||
<h2>ИИ-ассистент</h2>
|
||||
<form method="post" action="/settings/ai" class="ai-form" data-search="{{.Search.Engine}}">
|
||||
<input type="hidden" name="csrf" value="{{.CSRF}}">
|
||||
<label>Тип API<select name="ai_type">
|
||||
<option value="gradio"{{if eq .AI.Type "gradio"}} selected{{end}}>Gradio (Qwen Omni через прокси)</option>
|
||||
<option value="openai"{{if eq .AI.Type "openai"}} selected{{end}}>OpenAI-совместимый</option>
|
||||
<option value="anthropic"{{if eq .AI.Type "anthropic"}} selected{{end}}>Anthropic</option>
|
||||
</select></label>
|
||||
<label>Адрес<input type="url" name="ai_url" value="{{.AI.URL}}" placeholder="https://api.openai.com/v1"></label>
|
||||
<label>Модель<input type="text" name="ai_model" value="{{.AI.Model}}" placeholder="для OpenAI и Anthropic"></label>
|
||||
<label>Ключ<span class="keybox"><input type="password" name="ai_key" value="{{.AI.Key}}" placeholder="не задан" autocomplete="off" spellcheck="false">
|
||||
<button type="button" class="btn ghost small icon sq" title="Показать" aria-label="Показать ключ" onclick="var i=this.previousElementSibling;i.type=i.type==='password'?'text':'password'"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg></button></span></label>
|
||||
<p class="muted" style="margin:0">Моделей может быть несколько - в чате появится выбор; первая - по умолчанию.</p>
|
||||
<div class="ai-models">
|
||||
{{range .AIModels}} <fieldset class="ai-model">
|
||||
<input type="hidden" name="m_id" value="{{.ID}}">
|
||||
<div class="ai-model-head"><label class="ai-model-name">Название в чате<input type="text" name="m_name" value="{{.Name}}" placeholder="например, Claude"></label>
|
||||
<button type="button" class="btn ghost small close ai-model-del" title="Удалить модель" aria-label="Удалить модель">Удалить</button></div>
|
||||
<label>Тип API<select name="m_type">
|
||||
<option value="gradio"{{if eq .Type "gradio"}} selected{{end}}>Gradio (Qwen Omni через прокси)</option>
|
||||
<option value="openai"{{if eq .Type "openai"}} selected{{end}}>OpenAI-совместимый</option>
|
||||
<option value="anthropic"{{if eq .Type "anthropic"}} selected{{end}}>Anthropic</option>
|
||||
</select></label>
|
||||
<label>Адрес<input type="url" name="m_url" value="{{.URL}}" placeholder="https://api.openai.com/v1"></label>
|
||||
<label>Модель<input type="text" name="m_model" value="{{.Model}}" placeholder="для OpenAI и Anthropic"></label>
|
||||
<label>Ключ<span class="keybox"><input type="password" name="m_key" value="{{.Key}}" placeholder="не задан" autocomplete="off" spellcheck="false">
|
||||
<button type="button" class="btn ghost small icon sq" title="Показать" aria-label="Показать ключ" onclick="var i=this.previousElementSibling;i.type=i.type==='password'?'text':'password'"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg></button></span></label>
|
||||
</fieldset>
|
||||
{{end}} </div>
|
||||
<template class="ai-model-new">
|
||||
<fieldset class="ai-model">
|
||||
<input type="hidden" name="m_id" value="">
|
||||
<div class="ai-model-head"><label class="ai-model-name">Название в чате<input type="text" name="m_name" value="" placeholder="например, Claude"></label>
|
||||
<button type="button" class="btn ghost small close ai-model-del" title="Удалить модель" aria-label="Удалить модель">Удалить</button></div>
|
||||
<label>Тип API<select name="m_type">
|
||||
<option value="gradio">Gradio (Qwen Omni через прокси)</option>
|
||||
<option value="openai">OpenAI-совместимый</option>
|
||||
<option value="anthropic">Anthropic</option>
|
||||
</select></label>
|
||||
<label>Адрес<input type="url" name="m_url" value="" placeholder="https://api.openai.com/v1"></label>
|
||||
<label>Модель<input type="text" name="m_model" value="" placeholder="для OpenAI и Anthropic"></label>
|
||||
<label>Ключ<span class="keybox"><input type="password" name="m_key" value="" placeholder="не задан" autocomplete="off" spellcheck="false">
|
||||
<button type="button" class="btn ghost small icon sq" title="Показать" aria-label="Показать ключ" onclick="var i=this.previousElementSibling;i.type=i.type==='password'?'text':'password'"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg></button></span></label>
|
||||
</fieldset>
|
||||
</template>
|
||||
<div><button type="button" class="btn ghost small ai-model-add">+ Добавить модель</button></div>
|
||||
<h3 class="ai-sub">Поиск в интернете</h3>
|
||||
<p class="muted" style="margin:0">Запасной - DuckDuckGo.</p>
|
||||
<label>Поисковик<select name="ai_search" onchange="this.form.dataset.search = this.value">
|
||||
|
||||
Reference in new issue
Block a user