Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

add support for 01.AI (#1951)

黄腾c59c1b603d6c
diff --git a/conf/llm_factories.json b/conf/llm_factories.json
index 2e556edb6c..4d7ee1df8e 100644
--- a/conf/llm_factories.json
+++ b/conf/llm_factories.json
@@ -3051,6 +3051,68 @@
"model_type": "rerank"
}
]
- }
+ },
+ {
+ "name": "01.AI",
+ "logo": "",
+ "tags": "LLM,IMAGE2TEXT",
+ "status": "1",
+ "llm": [
+ {
+ "llm_name": "yi-large",
+ "tags": "LLM,CHAT,32k",
+ "max_tokens": 32768,
+ "model_type": "chat"
+ },
+ {
+ "llm_name": "yi-medium",
+ "tags": "LLM,CHAT,16k",
+ "max_tokens": 16384,
+ "model_type": "chat"
+ },
+ {
+ "llm_name": "yi-medium-200k",
+ "tags": "LLM,CHAT,200k",
+ "max_tokens": 204800,
+ "model_type": "chat"
+ },
+ {
+ "llm_name": "yi-spark",
+ "tags": "LLM,CHAT,16k",
+ "max_tokens": 16384,
+ "model_type": "chat"
+ },
+ {
+ "llm_name": "yi-large-rag",
+ "tags": "LLM,CHAT,16k",
+ "max_tokens": 16384,
+ "model_type": "chat"
+ },
+ {
+ "llm_name": "yi-large-fc",
+ "tags": "LLM,CHAT,32k",
+ "max_tokens": 32768,
+ "model_type": "chat"
+ },
+ {
+ "llm_name": "yi-large-turbo",
+ "tags": "LLM,CHAT,16k",
+ "max_tokens": 16384,
+ "model_type": "chat"
+ },
+ {
+ "llm_name": "yi-large-preview",
+ "tags": "LLM,CHAT,16k",
+ "max_tokens": 16384,
+ "model_type": "chat"
+ },
+ {
+ "llm_name": "yi-vision",
+ "tags": "LLM,CHAT,IMAGE2TEXT,16k",
+ "max_tokens": 16384,
+ "model_type": "image2text"
+ }
+ ]
+ }
]
}
diff --git a/rag/llm/__init__.py b/rag/llm/__init__.py
index 1756051d36..4f05929182 100644
--- a/rag/llm/__init__.py
+++ b/rag/llm/__init__.py
@@ -61,7 +61,8 @@ CvModel = {
"LM-Studio": LmStudioCV,
"StepFun":StepFunCV,
"OpenAI-API-Compatible": OpenAI_APICV,
- "TogetherAI": TogetherAICV
+ "TogetherAI": TogetherAICV,
+ "01.AI": YiCV
}
@@ -94,7 +95,8 @@ ChatModel = {
"PerfXCloud": PerfXCloudChat,
"Upstage":UpstageChat,
"novita.ai": NovitaAIChat,
- "SILICONFLOW": SILICONFLOWChat
+ "SILICONFLOW": SILICONFLOWChat,
+ "01.AI": YiChat
}
diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py
index 4696499a50..f5cdf5d255 100644
--- a/rag/llm/chat_model.py
+++ b/rag/llm/chat_model.py
@@ -1022,4 +1022,11 @@ class SILICONFLOWChat(Base):
def __init__(self, key, model_name, base_url="https://api.siliconflow.cn/v1"):
if not base_url:
base_url = "https://api.siliconflow.cn/v1"
+ super().__init__(key, model_name, base_url)
+
+
+class YiChat(Base):
+ def __init__(self, key, model_name, base_url="https://api.lingyiwanwu.com/v1"):
+ if not base_url:
+ base_url = "https://api.lingyiwanwu.com/v1"
super().__init__(key, model_name, base_url)
\ No newline at end of file
diff --git a/rag/llm/cv_model.py b/rag/llm/cv_model.py
index ee3de6bbd5..73d2ffbb02 100644
--- a/rag/llm/cv_model.py
+++ b/rag/llm/cv_model.py
@@ -622,6 +622,7 @@ class NvidiaCV(Base):
}
]
+
class StepFunCV(GptV4):
def __init__(self, key, model_name="step-1v-8k", lang="Chinese", base_url="https://api.stepfun.com/v1"):
if not base_url: base_url="https://api.stepfun.com/v1"
@@ -629,8 +630,9 @@ class StepFunCV(GptV4):
self.model_name = model_name
self.lang = lang
+
class LmStudioCV(GptV4):
- def __init__(self, key, model_name, base_url, lang="Chinese"):
+ def __init__(self, key, model_name, lang="Chinese", base_url=""):
if not base_url:
raise ValueError("Local llm url cannot be None")
if base_url.split("/")[-1] != "v1":
@@ -641,7 +643,7 @@ class LmStudioCV(GptV4):
class OpenAI_APICV(GptV4):
- def __init__(self, key, model_name, base_url, lang="Chinese"):
+ def __init__(self, key, model_name, lang="Chinese", base_url=""):
if not base_url:
raise ValueError("url cannot be None")
if base_url.split("/")[-1] != "v1":
@@ -652,7 +654,14 @@ class OpenAI_APICV(GptV4):
class TogetherAICV(GptV4):
- def __init__(self, key, model_name, base_url="https://api.together.xyz/v1"):
+ def __init__(self, key, model_name, lang="Chinese", base_url="https://api.together.xyz/v1"):
if not base_url:
base_url = "https://api.together.xyz/v1"
- super().__init__(key, model_name, base_url)
\ No newline at end of file
+ super().__init__(key, model_name,lang,base_url)
+
+
+class YiCV(GptV4):
+ def __init__(self, key, model_name, lang="Chinese",base_url="https://api.lingyiwanwu.com/v1",):
+ if not base_url:
+ base_url = "https://api.lingyiwanwu.com/v1"
+ super().__init__(key, model_name,lang,base_url)
\ No newline at end of file
diff --git a/web/src/assets/svg/llm/yi.svg b/web/src/assets/svg/llm/yi.svg
new file mode 100644
index 0000000000..83ebd22d9f
--- /dev/null
+++ b/web/src/assets/svg/llm/yi.svg
@@ -0,0 +1,7 @@
+<svg width="600" height="600" viewBox="0 0 600 600" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="300" cy="300" r="300" fill="white"/>
+<rect x="409.733" y="340.032" width="42.3862" height="151.648" rx="21.1931" fill="#003425"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M422.005 133.354C413.089 125.771 399.714 126.851 392.131 135.768L273.699 275.021C270.643 278.614 268.994 282.932 268.698 287.302C268.532 288.371 268.446 289.466 268.446 290.581V468.603C268.446 480.308 277.934 489.796 289.639 489.796C301.344 489.796 310.832 480.308 310.832 468.603V296.784L424.419 163.228C432.002 154.312 430.921 140.937 422.005 133.354Z" fill="#003425"/>
+<rect x="113.972" y="134.25" width="42.3862" height="174.745" rx="21.1931" transform="rotate(-39.3441 113.972 134.25)" fill="#003425"/>
+<circle cx="460.126" cy="279.278" r="25.9027" fill="#00DD20"/>
+</svg>
diff --git a/web/src/pages/user-setting/setting-model/constant.ts b/web/src/pages/user-setting/setting-model/constant.ts
index c13b22d40c..714159dcd8 100644
--- a/web/src/pages/user-setting/setting-model/constant.ts
+++ b/web/src/pages/user-setting/setting-model/constant.ts
@@ -30,6 +30,7 @@ export const IconMap = {
Upstage: 'upstage',
'novita.ai': 'novita-ai',
SILICONFLOW: 'siliconflow',
+ "01.AI": 'yi'
};
export const BedrockRegionList = [