Suggestions updated
This commit is contained in:
1 parent
19b340b004
commit
33fa0b4a89
3 files changed
+9
-3
No files matched your search
+3
-1
@@ -172,6 +172,8 @@ module.exports = (middleware, users, plans, assets) => {
|
||||
|
||||
const progress = await calculateProgress(plan, assets, users, req.session.userId);
|
||||
|
||||
const suggestions = await generateSuggestions(totalUserAssetValue, plan);
|
||||
|
||||
res.render('planDetail', {
|
||||
user: req.session.user,
|
||||
plan: plan,
|
||||
@@ -179,7 +181,7 @@ module.exports = (middleware, users, plans, assets) => {
|
||||
totalUserAssetValue: totalUserAssetValue,
|
||||
assets: userAssets,
|
||||
progress: progress,
|
||||
suggestions: await suggestions.generateSuggestions(),
|
||||
suggestions: suggestions,
|
||||
});
|
||||
|
||||
} catch (err) {
|
||||
|
||||
@@ -10,10 +10,14 @@ async function generateFact(factInput) {
|
||||
return response.text;
|
||||
}
|
||||
|
||||
async function generateSuggestions() {
|
||||
async function generateSuggestions(totalUserAssetValue, plan) {
|
||||
const response = await ai.models.generateContent({
|
||||
model: "gemini-2.0-flash",
|
||||
contents: "Return a mock investment suggestion 3-5 lines only, please do not include any extra text or explanation.",
|
||||
contents: `Return an investment suggestion 3-5 based on the user's total asset value and their plan. Please do not include any extra text or explanation.
|
||||
|
||||
Total User Asset Value: ${totalUserAssetValue}
|
||||
|
||||
Plan: ${plan}`,
|
||||
});
|
||||
return response.text;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user