mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-05 21:32:46 +02:00
send msgs in webhook tool calls
This commit is contained in:
parent
39282907d4
commit
80a98f1d7b
4 changed files with 10 additions and 2 deletions
|
|
@ -1054,11 +1054,12 @@ export async function updateWebhookUrl(projectId: string, url: string) {
|
|||
|
||||
export async function executeClientTool(
|
||||
toolCall: z.infer<typeof apiV1.AssistantMessageWithToolCalls>['tool_calls'][number],
|
||||
messages: z.infer<typeof apiV1.ChatMessage>[],
|
||||
projectId: string,
|
||||
): Promise<unknown> {
|
||||
await projectAuthCheck(projectId);
|
||||
|
||||
const result = await callClientToolWebhook(toolCall, projectId);
|
||||
const result = await callClientToolWebhook(toolCall, messages, projectId);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,11 @@ export async function POST(
|
|||
const toolCallResults = await Promise.all(lastMessage.tool_calls.map(async toolCall => {
|
||||
console.log('executing tool call', toolCall);
|
||||
try {
|
||||
return await callClientToolWebhook(toolCall, session.projectId);
|
||||
return await callClientToolWebhook(
|
||||
toolCall,
|
||||
[...messages, ...unsavedMessages],
|
||||
session.projectId,
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(`Error executing tool call ${toolCall.id}:`, error);
|
||||
return { error: "Tool execution failed" };
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import crypto from "crypto";
|
|||
|
||||
export async function callClientToolWebhook(
|
||||
toolCall: z.infer<typeof apiV1.AssistantMessageWithToolCalls>['tool_calls'][number],
|
||||
messages: z.infer<typeof apiV1.ChatMessage>[],
|
||||
projectId: string,
|
||||
): Promise<unknown> {
|
||||
const project = await projectsCollection.findOne({
|
||||
|
|
@ -23,6 +24,7 @@ export async function callClientToolWebhook(
|
|||
// prepare request body
|
||||
const content = JSON.stringify({
|
||||
toolCall,
|
||||
messages,
|
||||
} as z.infer<typeof ClientToolCallRequestBody>);
|
||||
const requestId = crypto.randomUUID();
|
||||
const bodyHash = crypto
|
||||
|
|
|
|||
|
|
@ -443,6 +443,7 @@ function ClientToolCall({
|
|||
try {
|
||||
response = await executeClientTool(
|
||||
toolCall,
|
||||
messages,
|
||||
projectId,
|
||||
);
|
||||
} catch (e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue