feat: upgrade to 0.0.52

This commit is contained in:
Tat Dat Duong
2025-03-10 18:11:53 +01:00
parent ab75027cfb
commit bf6595e055
8 changed files with 2230 additions and 4347 deletions

View File

@@ -176,29 +176,38 @@ export async function callTools(
if (stockbrokerToolCall) {
const prices = await getPricesForTicker(stockbrokerToolCall.args.ticker);
ui.write("stock-price", {
ticker: stockbrokerToolCall.args.ticker,
...prices,
});
ui.push(
{
name: "stock-price",
content: { ticker: stockbrokerToolCall.args.ticker, ...prices },
},
{ message },
);
}
if (portfolioToolCall) {
ui.write("portfolio", {});
ui.push({ name: "portfolio", content: {} }, { message });
}
if (buyStockToolCall) {
const snapshot = await getPriceSnapshotForTicker(
buyStockToolCall.args.ticker,
);
ui.write("buy-stock", {
toolCallId:
message.tool_calls?.find((tc) => tc.name === "buy-stock")?.id ?? "",
snapshot,
quantity: buyStockToolCall.args.quantity,
});
ui.push(
{
name: "buy-stock",
content: {
toolCallId:
message.tool_calls?.find((tc) => tc.name === "buy-stock")?.id ?? "",
snapshot,
quantity: buyStockToolCall.args.quantity,
},
},
{ message },
);
}
return {
messages: [message],
ui: ui.collect as StockbrokerUpdate["ui"],
ui: ui.items,
timestamp: Date.now(),
};
}