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>
20 lines
1.1 KiB
HTML
20 lines
1.1 KiB
HTML
<div id="ai_summary" class="ai-summary hide_if_nojs" {{- ' ' -}}
|
|
data-query="{{ answer.query }}" {{- ' ' -}}
|
|
data-grounding="{{ '1' if answer.grounding else '0' }}">{{- '' -}}
|
|
<div class="ai-summary-header">{{- '' -}}
|
|
<span class="ai-summary-title">{{ _('AI Summary') }}</span>{{- '' -}}
|
|
<span class="ai-summary-model"></span>{{- '' -}}
|
|
</div>{{- '' -}}
|
|
<div class="ai-summary-body collapsed">{{- '' -}}
|
|
<div class="ai-summary-answers" aria-live="polite"></div>{{- '' -}}
|
|
</div>{{- '' -}}
|
|
<button type="button" class="ai-summary-more invisible" {{- ' ' -}}
|
|
data-btn-text-collapsed="{{ _('More') }}" {{- ' ' -}}
|
|
data-btn-text-not-collapsed="{{ _('Less') }}">{{ _('More') }}</button>{{- '' -}}
|
|
<form class="ai-summary-followup invisible">{{- '' -}}
|
|
<input type="text" placeholder="{{ _('Ask a follow-up question') }}" autocomplete="off" maxlength="2048">{{- '' -}}
|
|
<button type="submit">{{ _('Ask') }}</button>{{- '' -}}
|
|
</form>{{- '' -}}
|
|
<p class="ai-summary-disclaimer">{{ _('Generated by AI — may contain mistakes.') }}</p>{{- '' -}}
|
|
</div>
|