4082d62bf58eec02bbe32ea28f686870d79fae46

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Share the scratch slot for flashcard generation

Diff

 1diff --git a/cmd/jp/main.go b/cmd/jp/main.go
 2index a626d9a5f3a8768761ca78be65eb528b3c738b62..5b4d46cae53b361680b7b836f8e30ef850469db0 100644
 3--- a/cmd/jp/main.go
 4+++ b/cmd/jp/main.go
 5@@ -29,14 +29,14 @@ const warmupTimeout = 30 * time.Second
 6 
 7 // llama-server slot assignments and the capture command are fixed for this
 8 // deployment; they are not user-configurable. One slot per prompt family keeps
 9-// each system prompt cached in the server's unified KV pool.
10+// each system prompt cached in the server's unified KV pool; scratch questions
11+// and flashcards share a slot since both are rare one-shot side tasks.
12 const (
13 	gameSlot       = 0
14 	judgeSlot      = 1
15 	compactionSlot = 2
16 	sheetSlot      = 3
17 	scratchSlot    = 4
18-	flashcardsSlot = 5
19 )
20 const recordCommand = "arecord"
21 
22@@ -54,7 +54,6 @@ func main() {
23 	compactionClient := newLLMClient(cfg, hc, compactionSlot)
24 	sheetClient := newLLMClient(cfg, hc, sheetSlot)
25 	scratchClient := newLLMClient(cfg, hc, scratchSlot)
26-	flashcardsClient := newLLMClient(cfg, hc, flashcardsSlot)
27 
28 	if err := availability.CheckAudio(hc, cfg.AudioConfig.AudioBaseURL, []string{tts.ModelName, stt.ASRModelName}); err != nil {
29 		fmt.Fprintf(os.Stderr, "jp: audio service unavailable: %v\n", err)
30@@ -75,7 +74,7 @@ func main() {
31 		{compactionClient, llm.CompactionPrompt()},
32 		{sheetClient, llm.SheetSystemPrompt()},
33 		{scratchClient, llm.ScratchSystemPrompt()},
34-		{flashcardsClient, llm.FlashcardSystemPrompt()},
35+		{scratchClient, llm.FlashcardSystemPrompt()},
36 	}
37 	ctx, cancel := context.WithTimeout(context.Background(), warmupTimeout)
38 	for _, w := range warmups {
39@@ -89,7 +88,7 @@ func main() {
40 	}
41 
42 	state := game.NewState(sc.Brief)
43-	orch := buildOrchestrator(cfg, state, hc, gameClient, judgeClient, compactionClient, sheetClient, scratchClient, flashcardsClient)
44+	orch := buildOrchestrator(cfg, state, hc, gameClient, judgeClient, compactionClient, sheetClient, scratchClient)
45 
46 	m := ui.NewModel(state, orch, int(recordCap.Seconds()))
47 	if _, err := tea.NewProgram(m).Run(); err != nil {
48@@ -97,13 +96,13 @@ func main() {
49 	}
50 }
51 
52-func buildOrchestrator(cfg *config.Config, state *game.State, hc *http.Client, gameClient, judgeClient, compactionClient, sheetClient, scratchClient, flashcardsClient *llm.Client) *game.Orchestrator {
53+func buildOrchestrator(cfg *config.Config, state *game.State, hc *http.Client, gameClient, judgeClient, compactionClient, sheetClient, scratchClient *llm.Client) *game.Orchestrator {
54 	gameModel := &adapters.GameModel{Client: gameClient}
55 	compactor := &adapters.Compactor{Client: compactionClient}
56 	judgeModel := &adapters.JudgeModel{Client: judgeClient}
57 	sheetModel := &adapters.SheetModel{Client: sheetClient}
58 	askModel := &adapters.ScratchModel{Client: scratchClient}
59-	flashModel := &adapters.FlashcardModel{Client: flashcardsClient}
60+	flashModel := &adapters.FlashcardModel{Client: scratchClient}
61 
62 	speechIn := &adapters.SpeechInput{
63 		Recorder: stt.NewRecorder(recordCommand, recordCap),