refactor(ai-event): migrate to OpenRouter chat.send API

Replace the deprecated callModel / getText pattern with the chat.send
method and extract the response content via extractContentFromChatResponse.
This aligns with the current OpenRouter SDK interface.
This commit is contained in:
2026-04-15 18:21:23 -04:00
parent 6bc84d5b58
commit ddc7a82e0e

View File

@@ -39,13 +39,17 @@ Rules:
`; `;
const callTextOnly = async (systemPrompt: string, prompt: string) => { const callTextOnly = async (systemPrompt: string, prompt: string) => {
const result = openRouterClient.callModel({ const response = await openRouterClient.chat.send({
chatRequest: {
model: MODEL, model: MODEL,
instructions: systemPrompt, messages: [
input: prompt, { role: "system", content: systemPrompt },
{ role: "user", content: prompt },
],
},
}); });
const rawResponse = await result.getText(); const rawResponse = extractContentFromChatResponse(response);
return { rawResponse }; return { rawResponse };
}; };