Changed prompt to create more randomness in the quiz#22
Changed prompt to create more randomness in the quiz#22matteomekhail wants to merge 2 commits intoT3-Content:mainfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughThe changes introduce a prompt diversification system that retrieves recent prompts from the database and integrates them into the generation pipeline, enabling style-based prompt generation and automatic avoidance of repeated patterns. Changes
Sequence Diagram(s)sequenceDiagram
participant Game as Game Logic
participant DB as Database
participant Prompt as Prompt Builder
participant API as Text Generation API
Game->>DB: getRecentPrompts(30)
DB-->>Game: recent prompts array
Game->>Prompt: buildPromptSystem(recentPrompts)
Prompt->>Prompt: Generate system prompt<br/>with style guidance and<br/>avoidance patterns
Prompt-->>Game: system prompt string
Game->>Game: Select random style<br/>from PROMPT_STYLES
Game->>API: generateText(systemPrompt,<br/>userPrompt, temp=1.2)
API-->>Game: generated prompt
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bias quiz prompt generation toward randomness by using recent prompts via
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
game.ts (2)
212-215: Remove the deadstylevariable insidebuildPromptSystem.Line 214 computes a random style but never references it within the function body — the string goes nowhere. The actual style selection and use happen separately in
callGeneratePromptat lines 239 and 245. This is a leftover from refactoring that wastes aMath.random()call and misleads the reader into expecting${style}to appear in the returned system string.♻️ Proposed fix
function buildPromptSystem(recentPrompts: string[]): string { const examples = shuffle([...ALL_PROMPTS]).slice(0, 80); - const style = PROMPT_STYLES[Math.floor(Math.random() * PROMPT_STYLES.length)]; - let system = `You are a comedy writer...🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@game.ts` around lines 212 - 215, The buildPromptSystem function declares a local variable style that is never used; remove the dead declaration (the const style = PROMPT_STYLES[...] line) so you don't consume a pointless Math.random() and avoid confusion with the actual style selection performed in callGeneratePrompt; update buildPromptSystem to only compute examples and the system string, leaving style handling to callGeneratePrompt and any other callers.
187-187: Inconsistent import extension for"./db".Line 187 imports from
"./db"(no extension) while line 302 imports from"./db.ts"(with extension). Both resolve correctly in Bun, but pick one convention and stick with it throughout the file.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@game.ts` at line 187, The import for getRecentPrompts uses "./db" while elsewhere the file imports "./db.ts" — make imports consistent by choosing one convention and updating the other(s). Locate the import statements referencing the db module (e.g., the getRecentPrompts import and the later import that uses "./db.ts") and change them all to the same path form (either all "./db" or all "./db.ts") so the file consistently uses one extension convention.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@game.ts`:
- Line 243: The temperature is hard-coded to 1.2 which violates Anthropic's
0.0–1.0 limit and causes OpenRouter requests to be rejected when an Anthropic
model from the MODELS array (e.g., "claude-opus-4.6" or "claude-sonnet-4.6") is
selected; update the request-building logic to enforce a valid temperature per
model: detect the chosen model from MODELS at selection time and clamp or
override the temperature to Math.min(requestedTemperature, 1.0) (or set to 1.0)
for Anthropic models before sending the request (the code path that calls
withRetry and builds the model request payload must apply this check). Ensure
the fix preserves the original temperature for non-Anthropic models and prevents
withRetry from exhausting retries due to API rejections.
---
Nitpick comments:
In `@game.ts`:
- Around line 212-215: The buildPromptSystem function declares a local variable
style that is never used; remove the dead declaration (the const style =
PROMPT_STYLES[...] line) so you don't consume a pointless Math.random() and
avoid confusion with the actual style selection performed in callGeneratePrompt;
update buildPromptSystem to only compute examples and the system string, leaving
style handling to callGeneratePrompt and any other callers.
- Line 187: The import for getRecentPrompts uses "./db" while elsewhere the file
imports "./db.ts" — make imports consistent by choosing one convention and
updating the other(s). Locate the import statements referencing the db module
(e.g., the getRecentPrompts import and the later import that uses "./db.ts") and
change them all to the same path form (either all "./db" or all "./db.ts") so
the file consistently uses one extension convention.
Changed prompt, implemented blacklist, random casual "style", more temp
Summary by CodeRabbit