Skip to content

Commit

Permalink
feat: support document analyse for GPT and DeepSeek
Browse files Browse the repository at this point in the history
  • Loading branch information
zhu-xiaowei committed Jan 24, 2025
1 parent 33413c3 commit e00dddb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions react-native/src/api/open-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '../storage/StorageUtils.ts';
import {
BedrockMessage,
DocumentContent,
ImageContent,
OpenAIMessage,
TextContent,
Expand Down Expand Up @@ -225,6 +226,18 @@ function getOpenAIMessages(
}),
};
}
const hasDoc = message.content.some(content => 'document' in content);
if (hasDoc) {
const text = message.content.find(
content => 'text' in content
) as TextContent;
const doc = message.content.find(content => 'document' in content);
const docContent = (doc as DocumentContent).document.source.bytes;
return {
role: message.role,
content: text.text + '\nDocument base64 is:\n ' + docContent,
};
}
return {
role: message.role,
content: message.content
Expand Down
3 changes: 2 additions & 1 deletion react-native/src/chat/component/CustomSendComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ const isMultiModalModel = (): boolean => {
textModelId.includes('nova-pro') ||
textModelId.includes('nova-lite') ||
textModelId.startsWith('ollama') ||
textModelId.startsWith('gpt')
textModelId.startsWith('gpt') ||
textModelId.startsWith('deepseek')
);
};

Expand Down

0 comments on commit e00dddb

Please sign in to comment.