Skip to content

Commit 761a4ff

Browse files
committed
fix: include tools in LLM session pairing
1 parent a93b1db commit 761a4ff

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

webhook/chat.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default async function handle(request) {
3535
if (lastAssistant === -1) {
3636
turn = await turnZero(messages, systemPrompt, tools, model);
3737
} else {
38-
turn = await continuation(messages, systemPrompt, lastAssistant);
38+
turn = await continuation(messages, systemPrompt, tools, lastAssistant);
3939
}
4040

4141
let reply;
@@ -71,8 +71,9 @@ async function turnZero(messages, systemPrompt, tools, model) {
7171

7272
// Turn k>=1: pair by the committed-history hash, deliver the delta (idempotently),
7373
// and return the response-stub id to read the reply from.
74-
async function continuation(messages, systemPrompt, lastAssistant) {
75-
const prefixHash = computePrefixHash(systemPrompt, messages, lastAssistant);
74+
async function continuation(messages, systemPrompt, tools, lastAssistant) {
75+
const workflowSystem = systemPrompt + renderToolsPrompt(tools);
76+
const prefixHash = computePrefixHash(workflowSystem, messages, lastAssistant);
7677
const priorToolCalls = toolCallsOf(messages[lastAssistant]);
7778
const delta = messagesToInput(messages.slice(lastAssistant + 1), priorToolCalls);
7879

0 commit comments

Comments
 (0)