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:
@@ -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({
|
||||||
model: MODEL,
|
chatRequest: {
|
||||||
instructions: systemPrompt,
|
model: MODEL,
|
||||||
input: prompt,
|
messages: [
|
||||||
|
{ role: "system", content: systemPrompt },
|
||||||
|
{ role: "user", content: prompt },
|
||||||
|
],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const rawResponse = await result.getText();
|
const rawResponse = extractContentFromChatResponse(response);
|
||||||
return { rawResponse };
|
return { rawResponse };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user