Fourth revision: OpenRouter, live tool stages, Explain layout, share sections
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 29s
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 29s
- Interactive blocks are encouraged by default; Explain gets a reduced library and never writes practice questions. - Assistant tool steps breathe while running, show live stages from generation and the Python check, and read in the past tense when done. - The assistant asks before searching the web when class materials do not cover a question; clarifying questions list every class's exams and never ask about format (always NCLEX). - Explain opens beside the question from 900px wide, moving the question left while open and back on the next one. - Generate dialog drops the practice set/exam switch (presets cover it) and the Generate buttons lose their icon. - Python check notes are green when every check passed, applied fixes neutral. - Share pages group by exam, then Quizzes, Flashcards, Notes, Class Materials, hiding empty groups; the class page uses the same order. "Documents" is now "Class Materials". - OpenRouter provider replaces the Ollama type; migration 6 turns Ollama connections into OpenAI-compatible ones at /v1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c595e0ff2c
commit
25bc03ea75
45 changed files with 663 additions and 329 deletions
|
|
@ -1,17 +1,33 @@
|
|||
/** Prompt instructions for interactive reply blocks, generated once from the shared catalog. */
|
||||
/** Prompt instructions for interactive reply blocks, generated once per mode from the shared catalog. */
|
||||
import { createLibrary, defineComponent } from '@openuidev/lang-core';
|
||||
import { GENUI_COMPONENTS, GENUI_EXAMPLES, GENUI_GROUPS, GENUI_PREAMBLE, GENUI_ROOT, GENUI_RULES } from '../../shared/genui.ts';
|
||||
import { GENUI_COMPONENTS, GENUI_EXAMPLES, GENUI_EXPLAIN_RULES, GENUI_GROUPS, GENUI_PREAMBLE, GENUI_ROOT, GENUI_RULES } from '../../shared/genui.ts';
|
||||
|
||||
let cached: string | null = null;
|
||||
/** Components that quiz the student; Explain leaves them out. */
|
||||
const PRACTICE = new Set(['Question', 'Flashcards', 'FlashCard']);
|
||||
|
||||
export function genUiPrompt(): string {
|
||||
if (cached === null) {
|
||||
const cached = new Map<string, string>();
|
||||
|
||||
/**
|
||||
* `chat`: the assistant and share-link chats. `explain`: Explain with AI, which gives information
|
||||
* only (no practice questions or flashcards).
|
||||
*/
|
||||
export function genUiPrompt(mode: 'chat' | 'explain' = 'chat'): string {
|
||||
let prompt = cached.get(mode);
|
||||
if (prompt === undefined) {
|
||||
const explain = mode === 'explain';
|
||||
const library = createLibrary({
|
||||
root: GENUI_ROOT,
|
||||
components: GENUI_COMPONENTS.map((c) => defineComponent({ ...c, component: null as never })),
|
||||
componentGroups: GENUI_GROUPS,
|
||||
components: GENUI_COMPONENTS.filter((c) => !explain || !PRACTICE.has(c.name)).map((c) => defineComponent({ ...c, component: null as never })),
|
||||
componentGroups: GENUI_GROUPS.map((g) => (explain ? { ...g, components: g.components.filter((n) => !PRACTICE.has(n)) } : g)).filter((g) => g.components.length > 0),
|
||||
});
|
||||
cached = `\n\n${library.prompt({ preamble: GENUI_PREAMBLE, additionalRules: GENUI_RULES, examples: GENUI_EXAMPLES, bindings: true })}`;
|
||||
const preamble = explain ? GENUI_PREAMBLE.replace(/\n- Teaching a concept the student can practise:[^\n]*/, '') : GENUI_PREAMBLE;
|
||||
prompt = `\n\n${library.prompt({
|
||||
preamble,
|
||||
additionalRules: explain ? [...GENUI_RULES, ...GENUI_EXPLAIN_RULES] : GENUI_RULES,
|
||||
examples: explain ? GENUI_EXAMPLES.filter((e) => !/Question\(|Flashcards\(/.test(e)) : GENUI_EXAMPLES,
|
||||
bindings: true,
|
||||
})}`;
|
||||
cached.set(mode, prompt);
|
||||
}
|
||||
return cached;
|
||||
return prompt;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue