mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-15 16:05:53 +08:00
### What problem does this PR solve? Feat: Extract the common parts of groupImage2TextOptions and groupOptionsByModelType #5063 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
a2b8ba472f
commit
375e727f9a
@ -5,6 +5,7 @@ import {
|
|||||||
IFactory,
|
IFactory,
|
||||||
IMyLlmValue,
|
IMyLlmValue,
|
||||||
IThirdOAIModelCollection as IThirdAiModelCollection,
|
IThirdOAIModelCollection as IThirdAiModelCollection,
|
||||||
|
IThirdOAIModel,
|
||||||
IThirdOAIModelCollection,
|
IThirdOAIModelCollection,
|
||||||
} from '@/interfaces/database/llm';
|
} from '@/interfaces/database/llm';
|
||||||
import {
|
import {
|
||||||
@ -55,6 +56,24 @@ export const useSelectLlmOptions = () => {
|
|||||||
return embeddingModelOptions;
|
return embeddingModelOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function buildLlmOptionsWithIcon(x: IThirdOAIModel) {
|
||||||
|
return {
|
||||||
|
label: (
|
||||||
|
<Flex align="center" gap={6}>
|
||||||
|
<LlmIcon
|
||||||
|
name={getLLMIconName(x.fid, x.llm_name)}
|
||||||
|
width={26}
|
||||||
|
height={26}
|
||||||
|
size={'small'}
|
||||||
|
/>
|
||||||
|
<span>{x.llm_name}</span>
|
||||||
|
</Flex>
|
||||||
|
),
|
||||||
|
value: `${x.llm_name}@${x.fid}`,
|
||||||
|
disabled: !x.available,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export const useSelectLlmOptionsByModelType = () => {
|
export const useSelectLlmOptionsByModelType = () => {
|
||||||
const llmInfo: IThirdOAIModelCollection = useFetchLlmList();
|
const llmInfo: IThirdOAIModelCollection = useFetchLlmList();
|
||||||
|
|
||||||
@ -73,21 +92,7 @@ export const useSelectLlmOptionsByModelType = () => {
|
|||||||
(x.tags && x.tags.includes(modelTag))) &&
|
(x.tags && x.tags.includes(modelTag))) &&
|
||||||
x.available,
|
x.available,
|
||||||
)
|
)
|
||||||
.map((x) => ({
|
.map(buildLlmOptionsWithIcon),
|
||||||
label: (
|
|
||||||
<Flex align="center" gap={6}>
|
|
||||||
<LlmIcon
|
|
||||||
name={getLLMIconName(x.fid, x.llm_name)}
|
|
||||||
width={26}
|
|
||||||
height={26}
|
|
||||||
size={'small'}
|
|
||||||
/>
|
|
||||||
<span>{x.llm_name}</span>
|
|
||||||
</Flex>
|
|
||||||
),
|
|
||||||
value: `${x.llm_name}@${x.fid}`,
|
|
||||||
disabled: !x.available,
|
|
||||||
})),
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter((x) => x.options.length > 0);
|
.filter((x) => x.options.length > 0);
|
||||||
@ -107,21 +112,7 @@ export const useSelectLlmOptionsByModelType = () => {
|
|||||||
(modelType ? x.model_type.includes(modelType) : true) &&
|
(modelType ? x.model_type.includes(modelType) : true) &&
|
||||||
x.available,
|
x.available,
|
||||||
)
|
)
|
||||||
.map((x) => ({
|
.map(buildLlmOptionsWithIcon),
|
||||||
label: (
|
|
||||||
<Flex align="center" gap={6}>
|
|
||||||
<LlmIcon
|
|
||||||
name={getLLMIconName(x.fid, x.llm_name)}
|
|
||||||
width={26}
|
|
||||||
height={26}
|
|
||||||
size={'small'}
|
|
||||||
/>
|
|
||||||
<span>{x.llm_name}</span>
|
|
||||||
</Flex>
|
|
||||||
),
|
|
||||||
value: `${x.llm_name}@${x.fid}`,
|
|
||||||
disabled: !x.available,
|
|
||||||
})),
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter((x) => x.options.length > 0);
|
.filter((x) => x.options.length > 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user