mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-15 06:05:54 +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,
|
||||
IMyLlmValue,
|
||||
IThirdOAIModelCollection as IThirdAiModelCollection,
|
||||
IThirdOAIModel,
|
||||
IThirdOAIModelCollection,
|
||||
} from '@/interfaces/database/llm';
|
||||
import {
|
||||
@ -55,6 +56,24 @@ export const useSelectLlmOptions = () => {
|
||||
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 = () => {
|
||||
const llmInfo: IThirdOAIModelCollection = useFetchLlmList();
|
||||
|
||||
@ -73,21 +92,7 @@ export const useSelectLlmOptionsByModelType = () => {
|
||||
(x.tags && x.tags.includes(modelTag))) &&
|
||||
x.available,
|
||||
)
|
||||
.map((x) => ({
|
||||
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,
|
||||
})),
|
||||
.map(buildLlmOptionsWithIcon),
|
||||
};
|
||||
})
|
||||
.filter((x) => x.options.length > 0);
|
||||
@ -107,21 +112,7 @@ export const useSelectLlmOptionsByModelType = () => {
|
||||
(modelType ? x.model_type.includes(modelType) : true) &&
|
||||
x.available,
|
||||
)
|
||||
.map((x) => ({
|
||||
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,
|
||||
})),
|
||||
.map(buildLlmOptionsWithIcon),
|
||||
};
|
||||
})
|
||||
.filter((x) => x.options.length > 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user