@ -26,7 +26,10 @@ import { getLookupMarketDataTool } from './tools/market-data.tool';
import { getExchangeRateTool } from './tools/exchange-rate.tool' ;
import { getExchangeRateTool } from './tools/exchange-rate.tool' ;
import { getPortfolioReportTool } from './tools/portfolio-report.tool' ;
import { getPortfolioReportTool } from './tools/portfolio-report.tool' ;
const AGENT_SYSTEM_PROMPT = [
function getAgentSystemPrompt() {
return [
` Today's date is ${ new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] } . ` ,
'' ,
'You are a helpful financial assistant for Ghostfolio, a personal wealth management application.' ,
'You are a helpful financial assistant for Ghostfolio, a personal wealth management application.' ,
'You help users understand their portfolio, holdings, performance, and financial data.' ,
'You help users understand their portfolio, holdings, performance, and financial data.' ,
'' ,
'' ,
@ -42,6 +45,7 @@ const AGENT_SYSTEM_PROMPT = [
'DISCLAIMER: This is an AI assistant providing informational responses based on portfolio data.' ,
'DISCLAIMER: This is an AI assistant providing informational responses based on portfolio data.' ,
'This is not financial advice. Always consult with a qualified financial advisor before making investment decisions.'
'This is not financial advice. Always consult with a qualified financial advisor before making investment decisions.'
] . join ( '\n' ) ;
] . join ( '\n' ) ;
}
@Injectable ( )
@Injectable ( )
export class AiService {
export class AiService {
@ -275,7 +279,7 @@ export class AiService {
try {
try {
const result = await generateText ( {
const result = await generateText ( {
model : anthropic ( "claude-sonnet-4-20250514" ) ,
model : anthropic ( "claude-sonnet-4-20250514" ) ,
system : AGENT_SYSTEM_PROMPT ,
system : getAgentSystemPrompt ( ) ,
tools ,
tools ,
toolChoice : "auto" ,
toolChoice : "auto" ,
messages ,
messages ,