b47fd08cb7
Add an optional, disabled-by-default plugin that shows an AI generated summary at the top of the result page, generated by a (local) Ollama server: - async: the result page is never delayed; a client plugin streams the answer (NDJSON over a new /ai_summary endpoint) into a placeholder answer with a typing indicator, collapsed behind a More button, with an inline follow-up chat - trigger: first page of general searches only, skipped when an infobox or instant answer already answers the query - grounding (per-user preference): send the top result snippets as context, the model answers from them instead of its own knowledge - configuration: new AI Summary preferences tab (server URL, model, grounding) with instance defaults in a new ai_summary: settings section; all three preferences can be locked for public instances Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
60 lines
2.8 KiB
HTML
60 lines
2.8 KiB
HTML
{%- if 'ai_summary_server' not in locked_preferences -%}
|
|
<fieldset>{{- '' -}}
|
|
<legend id="pref_ai_summary_server">{{- _('Ollama server URL') -}}</legend>{{- '' -}}
|
|
<div class="value">{{- '' -}}
|
|
<input name="ai_summary_server" aria-labelledby="pref_ai_summary_server" type="text"
|
|
autocomplete="off" spellcheck="false" autocorrect="off"
|
|
placeholder="{{ ai_summary_default_server or 'http://127.0.0.1:11434' }}"
|
|
value="{{ preferences.get_value('ai_summary_server') }}">{{- '' -}}
|
|
</div>{{- '' -}}
|
|
<div class="description">
|
|
{{- _('URL of the Ollama server that generates the summaries, e.g. http://192.168.1.10:11434.') -}}
|
|
{{- ' ' -}}
|
|
{%- if ai_summary_default_server -%}
|
|
{{- _('Leave empty to use the default of this instance.') -}}
|
|
{%- endif -%}
|
|
</div>{{- '' -}}
|
|
</fieldset>{{- '' -}}
|
|
{%- endif -%}
|
|
{%- if 'ai_summary_model' not in locked_preferences -%}
|
|
<fieldset>{{- '' -}}
|
|
<legend id="pref_ai_summary_model">{{- _('AI summary model') -}}</legend>{{- '' -}}
|
|
<div class="value">{{- '' -}}
|
|
<input name="ai_summary_model" aria-labelledby="pref_ai_summary_model" type="text"
|
|
autocomplete="off" spellcheck="false" autocorrect="off" list="ai_summary_model_list"
|
|
placeholder="{{ ai_summary_default_model or 'llama3.2:3b' }}"
|
|
value="{{ preferences.get_value('ai_summary_model') }}">{{- '' -}}
|
|
<datalist id="ai_summary_model_list">
|
|
{%- for model in ai_summary_models -%}
|
|
<option value="{{ model }}"></option>
|
|
{%- endfor -%}
|
|
</datalist>{{- '' -}}
|
|
</div>{{- '' -}}
|
|
<div class="description">
|
|
{{- _('Name of the model used to generate the summaries, e.g. llama3.2:3b or gemma3:4b.') -}}
|
|
{{- ' ' -}}
|
|
{%- if ai_summary_default_model -%}
|
|
{{- _('Leave empty to use the default of this instance.') -}}
|
|
{%- endif -%}
|
|
</div>{{- '' -}}
|
|
</fieldset>{{- '' -}}
|
|
{%- endif -%}
|
|
{%- if 'ai_summary_grounding' not in locked_preferences -%}
|
|
<fieldset>{{- '' -}}
|
|
<legend id="pref_ai_summary_grounding">{{ _('Ground AI summary on search results') }}</legend>{{- '' -}}
|
|
<p class="value">{{- '' -}}
|
|
<input type="checkbox" {{- ' ' -}}
|
|
name="ai_summary_grounding" {{- ' ' -}}
|
|
aria-labelledby="pref_ai_summary_grounding" {{- ' ' -}}
|
|
class="checkbox-onoff" {{- ' ' -}}
|
|
{%- if preferences.get_value('ai_summary_grounding') -%}
|
|
checked
|
|
{%- endif -%}{{- ' ' -}}
|
|
>{{- '' -}}
|
|
</p>{{- '' -}}
|
|
<div class="description">
|
|
{{- _('Send the top search results along with the query, the model answers from this context instead of its own knowledge. Answers are more accurate and more current, but generating them is slower and needs more memory (VRAM) on the Ollama server.') -}}
|
|
</div>{{- '' -}}
|
|
</fieldset>{{- '' -}}
|
|
{%- endif -%}
|