Spaces:
Sleeping
Sleeping
Download web/src/lib/history.ts from TBM99/CoverageCheck: direct link, hf CLI and curl.
- Browser
- Download file 769 Bytes
-
https://huggingface.co/spaces/TBM99/CoverageCheck/resolve/main/web/src/lib/history.ts
- Command line
-
hf download hf://spaces/TBM99/CoverageCheck/web/src/lib/history.ts
-
curl -L -o history.ts https://huggingface.co/spaces/TBM99/CoverageCheck/resolve/main/web/src/lib/history.ts
769 Bytes
| // What the chat sends with a follow-up: the earlier turns that got an answer, each with | |
| // the question as the system understood it (a rewritten follow-up, not the raw words), | |
| // so the next rewrite builds on resolved questions. The server reads only the last few | |
| // (config.WEB_HISTORY_TURNS = 4); sending just those keeps the request small. | |
| import type { RunState } from './run' | |
| import type { HistoryTurn } from './sse' | |
| export const HISTORY_TURNS = 4 // mirrors config.WEB_HISTORY_TURNS | |
| export function historyOf(turns: { question: string; run: RunState }[]): HistoryTurn[] { | |
| return turns | |
| .filter((t) => t.run.answer !== null) | |
| .slice(-HISTORY_TURNS) | |
| .map((t) => ({ question: t.run.rewrite?.question ?? t.question, answer: t.run.answer!.answer })) | |
| } | |