milwright commited on
Commit
7a48149
·
1 Parent(s): a261c04

fix: make chat responses direct and concise like proper clues

Browse files
Files changed (1) hide show
  1. src/aiService.js +10 -8
src/aiService.js CHANGED
@@ -80,11 +80,13 @@ class OpenRouterService {
80
  }
81
 
82
  try {
 
 
83
  const prompts = {
84
- part_of_speech: `What part of speech is the word in this blank in: "${sentence}"? Provide a clear, direct answer.`,
85
- sentence_role: `What grammatical role does the word in this blank play in: "${sentence}"? Focus on its function.`,
86
- word_category: `Is the word in this blank an abstract or concrete noun? Explain briefly with an example.`,
87
- synonym: `What's a good synonym for the word that would fit in this blank: "${sentence}"?`
88
  };
89
 
90
  const response = await fetch(this.apiUrl, {
@@ -99,13 +101,13 @@ class OpenRouterService {
99
  model: this.model,
100
  messages: [{
101
  role: 'system',
102
- content: 'You are a helpful reading tutor. Provide clear, educational answers that help students learn without giving away the answer directly.'
103
  }, {
104
  role: 'user',
105
- content: prompts[questionType] || `Help me understand the word that fits in this context: "${sentence}"`
106
  }],
107
- max_tokens: 150,
108
- temperature: 0.7
109
  })
110
  });
111
 
 
80
  }
81
 
82
  try {
83
+ const baseContext = `From "${bookTitle}" by ${author}: "${sentence}"`;
84
+
85
  const prompts = {
86
+ part_of_speech: `${baseContext}\n\nWhat part of speech is the missing word? Look at the sentence structure.`,
87
+ sentence_role: `${baseContext}\n\nWhat grammatical role does the missing word play? How does it function in the sentence?`,
88
+ word_category: `${baseContext}\n\nIs the missing word concrete or abstract? What type of concept does it represent?`,
89
+ synonym: `${baseContext}\n\nWhat's a related word or concept that would fit in this blank?`
90
  };
91
 
92
  const response = await fetch(this.apiUrl, {
 
101
  model: this.model,
102
  messages: [{
103
  role: 'system',
104
+ content: 'You provide clues for word puzzles. Give useful information about grammar, meaning, or context. Keep responses short and focused. Never reveal the actual word.'
105
  }, {
106
  role: 'user',
107
+ content: prompts[questionType] || `${baseContext}\n\nProvide a helpful hint about the missing word. Use contextual clues and guide the reader toward the answer without revealing it.`
108
  }],
109
+ max_tokens: 100,
110
+ temperature: 0.6
111
  })
112
  });
113