Skip to content

Commit

Permalink
🐛 fix: Azure OpenAI vision models issue (lobehub#2207)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnoyiX committed May 8, 2024
1 parent b98de56 commit b91dc6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libs/agent-runtime/azureOpenai/index.ts
Expand Up @@ -32,14 +32,14 @@ export class LobeAzureOpenAI implements LobeRuntimeAI {

// fix the issue: "The sample encountered an error: TypeError: Cannot read properties of undefined (reading 'url')"
messages.forEach(message => {
if (message['content'] instanceof Array) {
if (Array.isArray(message['content'])) {
message['content'].forEach((content: any) => {
if (content['type'] === 'image_url') {
content['imageUrl'] = content['image_url'];
delete content['image_url'];
}
});
};
}
});

// ============ 2. send api ============ //
Expand Down

0 comments on commit b91dc6f

Please sign in to comment.