You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: server/Mental Health api/infrastructure/geminiai/geminiService.js
+32-20
Original file line number
Diff line number
Diff line change
@@ -62,8 +62,12 @@ class GeminiApi extends QuoteRepository{
62
62
63
63
"You are doing great! Keep up the good work and stay positive"
64
64
65
+
if mood is "sad", the response could be:
66
+
"It's okay to feel sad sometimes. Remember to take care of yourself and reach out to someone you trust for support"
65
67
66
-
so the mood is : ${mood}
68
+
so the mood of the user is : ${mood}
69
+
70
+
onrefresh provide new advice on each request
67
71
68
72
return only the string no brackets no keyword no JSON nothing
69
73
@@ -99,11 +103,29 @@ class GeminiApi extends QuoteRepository{
99
103
100
104
101
105
// const result = generateText(prompt);
106
+
102
107
103
-
constresult=awaitmodel.generateContent(prompt);
104
-
constresponse=awaitresult.response;
105
-
consttext=response.text();
106
-
returntext;
108
+
constres=awaitgroq.chat.completions.create({
109
+
messages: [
110
+
{
111
+
role: "user",
112
+
content: prompt,
113
+
},
114
+
],
115
+
model: "llama3-8b-8192",
116
+
117
+
temperature: 1,
118
+
max_tokens: 2048,
119
+
120
+
121
+
});
122
+
123
+
returnres.choices[0].message.content;
124
+
125
+
// const result = await model.generateContent(prompt);
126
+
// const response = await result.response;
127
+
// const text = response.text();
128
+
// return text;
107
129
}
108
130
109
131
asyncgetDailyQuotes(){
@@ -116,22 +138,9 @@ class GeminiApi extends QuoteRepository{
116
138
noonQuote: "Your noon quote here",
117
139
eveningQuote: "Your evening quote here"
118
140
}
141
+
Provide concise and precise quotes that are inspirational and motivational. The quotes should be different for each part of the day.
119
142
120
-
return only those values for the quotes in which the current INDIAN STANDARD TIME falls. For example, if the IST (INDIAN STANDARD TIME) is 05:00:00 then the response is:
121
-
122
-
{
123
-
morningQuote: "Your morning quote here",
124
-
noonQuote: "To be provided at noon",
125
-
eveningQuote: "To be provided in the evening"
126
-
}
127
-
128
-
129
-
reference for time , do not include any source code in the response and omit the word json in the response:
130
-
00:00:00 to 11:59:59 - morning
131
-
12:00:00 to 17:59:59 - noon
132
-
18:00:00 to 23:59:59 - evening
133
-
134
-
provide new quotes on each request
143
+
do not include any source code in the response and omit the word json in the response also provide new quotes on each request
135
144
136
145
`;
137
146
@@ -145,6 +154,9 @@ class GeminiApi extends QuoteRepository{
0 commit comments