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