This commit is contained in:
felix
2026-09-14 16:34:17 +02:00
parent 789a676425
commit f128255226
27 changed files with 108 additions and 588 deletions

View File

@@ -1,6 +1,6 @@
// The report assistant: what the chat says when this service answers a turn.
// Runs the iteration-1 loop with the conversation so far, and turns a report
// run into an interim message with a pending file.
// What this service answers a chat turn with: the LLM loop with the
// conversation so far, and a report run becomes an interim message with a
// pending file.
import { ask } from './llm/loop.js';
const TEXT = {
@@ -8,13 +8,11 @@ const TEXT = {
failed: 'Het rapport is mislukt. Stel de vraag opnieuw, of anders geformuleerd.',
};
// whenProfiles() resolves once the SHACL profiles are loaded (app.js keeps
// the load promise), so the chat mounts before the profiles are in.
// The chat mounts before the profiles are in; whenProfiles waits for the load.
export function reportAssistant(whenProfiles) {
return async function answer(turn) {
// the pending file of the current run; the end callback needs the one
// the start callback made. One report per turn: a second run_report in
// the same turn overwrites this before the first end callback fires.
// One pending file per turn: a second run_report overwrites it before the
// first end callback fires.
let pendingDocument = null;
const session = {
@@ -43,8 +41,8 @@ export function reportAssistant(whenProfiles) {
};
}
// The file service serves /files/<uuid>/download, and the logical file URI
// that registerFile returns ends in that uuid.
// The file service serves /files/<uuid>/download; the logical file URI ends
// in that uuid.
function downloadHref(fileUri) {
return `/files/${fileUri.split('/').pop()}/download`;
}