feat: wire TradingGraph to use settings for model, temperature, and risk config
This commit is contained in:
@@ -17,8 +17,7 @@ export async function action({ request }: { request: Request }) {
|
||||
}
|
||||
|
||||
// Load server-only modules dynamically to prevent them from being included in client bundles
|
||||
const { OpenRouterClient } = await import("../../lib/openrouter");
|
||||
const { TradingGraph } = await import("../../agents/tradingGraph");
|
||||
const { buildTradingGraph } = await import("../../lib/tradingConfig.server");
|
||||
const { db } = await import("../../lib/db.server");
|
||||
const { fetchAccount, fetchRecentCloses, fetchBars } = await import("../../lib/alpacaClient");
|
||||
|
||||
@@ -59,8 +58,8 @@ export async function action({ request }: { request: Request }) {
|
||||
return Response.json(mockDecision);
|
||||
}
|
||||
|
||||
const client = new OpenRouterClient(apiKey);
|
||||
const graph = new TradingGraph(client);
|
||||
const { graph, config } = await buildTradingGraph(apiKey);
|
||||
console.log("[analyze] Trading config:", config);
|
||||
|
||||
// Fetch latest Alpaca account and recent prices; abort if unavailable
|
||||
let account: any = undefined;
|
||||
@@ -124,7 +123,7 @@ export async function action({ request }: { request: Request }) {
|
||||
// Optionally ask LLM to verify/adjust the computed plan if API key is present
|
||||
if (process.env.OPENROUTER_API_KEY) {
|
||||
try {
|
||||
decision = await verifyExecutionPlanWithLLM(decision, input);
|
||||
decision = await verifyExecutionPlanWithLLM(decision, input, config.model);
|
||||
} catch (e) {
|
||||
console.warn("LLM verification failed:", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user