bulltrackers-module 1.0.74 → 1.0.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -28,24 +28,32 @@ Respond with only one of those three words.
|
|
|
28
28
|
Post: "${snippet}"`;
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
|
+
// --- START FIX: Corrected Request Payload ---
|
|
32
|
+
// The payload must include `role: 'user'` and a `parts` array.
|
|
33
|
+
// Generation settings are nested under `generationConfig`.
|
|
31
34
|
const request = {
|
|
32
35
|
contents: [
|
|
33
36
|
{
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
role: "user",
|
|
38
|
+
parts: [ { text: prompt } ]
|
|
36
39
|
}
|
|
37
40
|
],
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
generationConfig: {
|
|
42
|
+
temperature: 0.1,
|
|
43
|
+
topP: 0.1,
|
|
44
|
+
maxOutputTokens: 10
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
// --- END FIX ---
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
const result = await geminiModel.generateContent(request);
|
|
50
|
+
const response = result.response;
|
|
48
51
|
|
|
52
|
+
// --- START FIX: Corrected Response Parsing ---
|
|
53
|
+
// The text is located at `content.parts[0].text`,
|
|
54
|
+
// not `content[0].text` as in the original file.
|
|
55
|
+
const text = response?.candidates?.[0]?.content?.parts?.[0]?.text?.trim() || '';
|
|
56
|
+
// --- END FIX ---
|
|
49
57
|
|
|
50
58
|
// Robust parsing: Find the keyword, case-insensitive.
|
|
51
59
|
const match = text.match(/(Bullish|Bearish|Neutral)/i);
|