feat: support visual model file upload

This commit is contained in:
Hk-Gosuto 2024-06-02 20:05:56 +08:00
parent fe9a17693c
commit 991dd0490f
2 changed files with 9 additions and 1 deletions

View File

@ -531,7 +531,7 @@ export function ChatActions(props: {
useEffect(() => {
const show = isVisionModel(currentModel);
setShowUploadImage(show);
setShowUploadFile(isEnableRAG && !show && isSupportRAGModel(currentModel));
setShowUploadFile(isEnableRAG && isSupportRAGModel(currentModel));
if (!show) {
props.setAttachImages([]);
props.setUploading(false);

View File

@ -267,6 +267,14 @@ export function isVisionModel(model: string) {
}
export function isSupportRAGModel(modelName: string) {
const specialModels = [
"gpt-4-turbo",
"gpt-4-turbo-2024-04-09",
"gpt-4o",
"gpt-4o-2024-05-13",
];
if (specialModels.some((keyword) => modelName === keyword)) return true;
if (isVisionModel(modelName)) return false;
return DEFAULT_MODELS.filter((model) => model.provider.id === "openai").some(
(model) => model.name === modelName,
);