{% extends "base.html" %} {% from "_help.html" import info %} {% from "_job_status.html" import job_status %} {% block title %}Ask — Paperful{% endblock %} {% block body_attrs %}{% if poll_run %} data-poll-run="{{ poll_run }}"{% endif %}{% endblock %} {% block content %}

Ask

{% if coach %}
{{ coach }}
{% endif %} {% if error %}
{{ error }}
{% endif %}

{{ message }} Scope follows the collection chip. Answers name the papers and pages they used.

{% if flags.remote_llm %}

Remote LLM — excerpts from your PDFs leave this machine.

{% endif %} {% if flags.remote_embed %}

Remote embedding model — passage text leaves this machine.

{% endif %} {% if flags.can_ingest and not flags.can_ask %}

Ingest first

Ask reads the local index, not live Zotero. Index the current collection (or the whole mirror when no chip is set), then this page can answer.

{{ job_status(ingest_result, 'Ingest') }} {% if ingest_result.summary %}

{% if ingest_result.dry_run %}Would index{% else %}Indexed{% endif %} {{ ingest_result.summary.pdf + ingest_result.summary.ocr }} PDFs ({{ ingest_result.summary.ocr }} after OCR) and {{ ingest_result.summary.abstract }} abstracts. Unchanged {{ ingest_result.summary.unchanged }}, failed {{ ingest_result.summary.failed }}.

{% endif %}
{{ info("Count what would be indexed. Writes nothing.") }} {{ info("Write new or changed PDFs and abstracts into the local index.") }}
{% if prefs.advanced %}

Open Index for search, extract questions, and status.

{% endif %}
{% endif %} {% if flags.can_ask %}

Ask

Answer a question from indexed passages, with sources. Follow-up turns stay in a thread. Scope follows the collection chip unless you set item keys below.

{{ job_status(ask_result, 'Ask') }}

Scope: {% if prefs.collection %}{{ prefs.collection }}{% else %}entire mirror{% endif %} · New thread

{% if threads %}
Threads ({{ threads|length }})
{% endif %}
{% for turn in turns %}

{{ turn.role }}

{{ turn.content }}
{% endfor %}
{% if last_result.sources %}

{% if last_result.cited %}Sources{% else %}Retrieved, not cited{% endif %}

{% endif %}

Question {{ info("One question for this turn. A custom prompt below overrides Focus.") }}

{{ info("Retrieve passages and answer this question. Follow-ups stay in this thread.") }}
{% include "_rag_scope_fields.html" %} {% include "_rag_prompt_fields.html" %}
{% elif flags.rag_on and not flags.llm_on %}

Turn on [llm] in config.toml for Ask. Settings does not toggle it.

{% endif %} {% if flags.llm_on and flags.rag_on and prefs.advanced %}

Batch Ask

Run many questions at once against the same scope. One question per line, or upload a text file. Results land under state/ask-batch/ and optionally as a Zotero collection note.

{{ job_status(batch_result, 'Batch Ask') }} {% if batch_result.stamp %}

Last batch: {{ batch_result.answered }}/{{ batch_result.questions }} answers

{% endif %}

Questions {{ info("One question per line. An upload is used when the box is empty.") }}

{% include "_rag_scope_fields.html" %}

Output {{ info("Where answers go and whether cached answers may be reused.") }}

{{ info("Answer every question in the list against the same scope. Spends tokens.") }}
{% include "_rag_prompt_fields.html" %}
{% if packs %}
Recent batches ({{ packs|length }})
{% endif %}
{% endif %} {% endblock %}