bulltrackers-module 1.0.74 → 1.0.75
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,31 @@ Respond with only one of those three words.
|
|
|
28
28
|
Post: "${snippet}"`;
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
|
+
// --- START FIX ---
|
|
32
|
+
// The request payload was malformed.
|
|
33
|
+
// 1. `contents` must have a `parts` array.
|
|
34
|
+
// 2. `generationConfig` must be a nested object.
|
|
31
35
|
const request = {
|
|
32
36
|
contents: [
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
text: prompt
|
|
37
|
+
{
|
|
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 ---
|
|
53
|
+
// 3. The response structure is content.parts[0].text, not content[0].text
|
|
54
|
+
const text = response?.candidates?.[0]?.content?.parts?.[0]?.text?.trim() || '';
|
|
55
|
+
// --- END FIX ---
|
|
49
56
|
|
|
50
57
|
// Robust parsing: Find the keyword, case-insensitive.
|
|
51
58
|
const match = text.match(/(Bullish|Bearish|Neutral)/i);
|