Spaces:
Sleeping
Sleeping
fix: make chat responses direct and concise like proper clues
Browse files- 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:
|
85 |
-
sentence_role:
|
86 |
-
word_category:
|
87 |
-
synonym:
|
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
|
103 |
}, {
|
104 |
role: 'user',
|
105 |
-
content: prompts[questionType] ||
|
106 |
}],
|
107 |
-
max_tokens:
|
108 |
-
temperature: 0.
|
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 |
|