mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-19 12:06:42 +08:00
add huggingface model (#2624)
### What problem does this PR solve? #2469 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
committed by
GitHub
parent
1b2f66fc11
commit
96f56a3c43
@ -26,4 +26,5 @@ export const LocalLlmFactories = [
|
||||
'TogetherAI',
|
||||
'Replicate',
|
||||
'OpenRouter',
|
||||
'HuggingFace',
|
||||
];
|
||||
|
||||
@ -40,6 +40,7 @@ export const IconMap = {
|
||||
Anthropic: 'anthropic',
|
||||
'Voyage AI': 'voyage',
|
||||
'Google Cloud': 'google-cloud',
|
||||
HuggingFace: 'huggingface',
|
||||
};
|
||||
|
||||
export const BedrockRegionList = [
|
||||
|
||||
@ -8,6 +8,20 @@ type FieldType = IAddLlmRequestBody & { vision: boolean };
|
||||
|
||||
const { Option } = Select;
|
||||
|
||||
const llmFactoryToUrlMap = {
|
||||
Ollama: 'https://huggingface.co/docs/text-embeddings-inference/quick_tour',
|
||||
Xinference: 'https://inference.readthedocs.io/en/latest/user_guide',
|
||||
LocalAI: 'https://localai.io/docs/getting-started/models/',
|
||||
'LM-Studio': 'https://lmstudio.ai/docs/basics',
|
||||
'OpenAI-API-Compatible': 'https://platform.openai.com/docs/models/gpt-4',
|
||||
TogetherAI: 'https://docs.together.ai/docs/deployment-options',
|
||||
Replicate: 'https://replicate.com/docs/topics/deployments',
|
||||
OpenRouter: 'https://openrouter.ai/docs',
|
||||
HuggingFace:
|
||||
'https://huggingface.co/docs/text-embeddings-inference/quick_tour',
|
||||
};
|
||||
type LlmFactory = keyof typeof llmFactoryToUrlMap;
|
||||
|
||||
const OllamaModal = ({
|
||||
visible,
|
||||
hideModal,
|
||||
@ -35,7 +49,9 @@ const OllamaModal = ({
|
||||
|
||||
onOk?.(data);
|
||||
};
|
||||
|
||||
const url =
|
||||
llmFactoryToUrlMap[llmFactory as LlmFactory] ||
|
||||
'https://huggingface.co/docs/text-embeddings-inference/quick_tour';
|
||||
return (
|
||||
<Modal
|
||||
title={t('addLlmTitle', { name: llmFactory })}
|
||||
@ -46,11 +62,7 @@ const OllamaModal = ({
|
||||
footer={(originNode: React.ReactNode) => {
|
||||
return (
|
||||
<Flex justify={'space-between'}>
|
||||
<a
|
||||
href={`https://github.com/infiniflow/ragflow/blob/main/docs/guides/deploy_local_llm.mdx`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
<a href={url} target="_blank" rel="noreferrer">
|
||||
{t('ollamaLink', { name: llmFactory })}
|
||||
</a>
|
||||
<Space>{originNode}</Space>
|
||||
@ -72,10 +84,16 @@ const OllamaModal = ({
|
||||
rules={[{ required: true, message: t('modelTypeMessage') }]}
|
||||
>
|
||||
<Select placeholder={t('modelTypeMessage')}>
|
||||
<Option value="chat">chat</Option>
|
||||
<Option value="embedding">embedding</Option>
|
||||
<Option value="rerank">rerank</Option>
|
||||
<Option value="image2text">image2text</Option>
|
||||
{llmFactory === 'HuggingFace' ? (
|
||||
<Option value="embedding">embedding</Option>
|
||||
) : (
|
||||
<>
|
||||
<Option value="chat">chat</Option>
|
||||
<Option value="embedding">embedding</Option>
|
||||
<Option value="rerank">rerank</Option>
|
||||
<Option value="image2text">image2text</Option>
|
||||
</>
|
||||
)}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item<FieldType>
|
||||
|
||||
Reference in New Issue
Block a user