Skip to content

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

Fix: Hunyuan cannot work properly (#12843)

Yongteng Lei2a758402ad0a
diff --git a/api/apps/llm_app.py b/api/apps/llm_app.py
index 695f4f13e8..6282613409 100644
--- a/api/apps/llm_app.py
+++ b/api/apps/llm_app.py
@@ -146,10 +146,6 @@ async def add_llm():
# Assemble ark_api_key endpoint_id into api_key
api_key = apikey_json(["ark_api_key", "endpoint_id"])
- elif factory == "Tencent Hunyuan":
- req["api_key"] = apikey_json(["hunyuan_sid", "hunyuan_sk"])
- return await set_api_key()
-
elif factory == "Tencent Cloud":
req["api_key"] = apikey_json(["tencent_cloud_sid", "tencent_cloud_sk"])
return await set_api_key()
diff --git a/rag/llm/__init__.py b/rag/llm/__init__.py
index ce5b5ef234..c610e4fdff 100644
--- a/rag/llm/__init__.py
+++ b/rag/llm/__init__.py
@@ -57,6 +57,7 @@ class SupportedLiteLLMProvider(StrEnum):
OpenAI = "OpenAI"
Azure_OpenAI = "Azure-OpenAI"
n1n = "n1n"
+ HunYuan = "Tencent Hunyuan"
FACTORY_DEFAULT_BASE_URL = {
@@ -83,6 +84,7 @@ FACTORY_DEFAULT_BASE_URL = {
SupportedLiteLLMProvider.DeerAPI: "https://api.deerapi.com/v1",
SupportedLiteLLMProvider.OpenAI: "https://api.openai.com/v1",
SupportedLiteLLMProvider.n1n: "https://api.n1n.ai/v1",
+ SupportedLiteLLMProvider.HunYuan: "https://api.hunyuan.cloud.tencent.com/v1",
}
@@ -121,6 +123,7 @@ LITELLM_PROVIDER_PREFIX = {
SupportedLiteLLMProvider.OpenAI: "openai/",
SupportedLiteLLMProvider.Azure_OpenAI: "azure/",
SupportedLiteLLMProvider.n1n: "openai/",
+ SupportedLiteLLMProvider.HunYuan: "openai/",
}
ChatModel = globals().get("ChatModel", {})
diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py
index f7ee30a6f1..0e9fea1f3f 100644
--- a/rag/llm/chat_model.py
+++ b/rag/llm/chat_model.py
@@ -34,8 +34,6 @@ from common.token_utils import num_tokens_from_string, total_token_count_from_re
from rag.llm import FACTORY_DEFAULT_BASE_URL, LITELLM_PROVIDER_PREFIX, SupportedLiteLLMProvider
from rag.nlp import is_chinese, is_english
-# Error message constants
-
from common.misc_utils import thread_pool_exec
class LLMErrorCode(StrEnum):
ERROR_RATE_LIMIT = "RATE_LIMIT_EXCEEDED"
@@ -106,7 +104,7 @@ class Base(ABC):
if "gpt-5" in model_name_lower:
gen_conf = {}
return gen_conf
-
+
if "max_tokens" in gen_conf:
del gen_conf["max_tokens"]
@@ -793,84 +791,6 @@ class ReplicateChat(Base):
yield num_tokens_from_string(ans)
-class HunyuanChat(Base):
- _FACTORY_NAME = "Tencent Hunyuan"
-
- def __init__(self, key, model_name, base_url=None, **kwargs):
- super().__init__(key, model_name, base_url=base_url, **kwargs)
-
- from tencentcloud.common import credential
- from tencentcloud.hunyuan.v20230901 import hunyuan_client
-
- key = json.loads(key)
- sid = key.get("hunyuan_sid", "")
- sk = key.get("hunyuan_sk", "")
- cred = credential.Credential(sid, sk)
- self.model_name = model_name
- self.client = hunyuan_client.HunyuanClient(cred, "")
-
- def _clean_conf(self, gen_conf):
- _gen_conf = {}
- if "temperature" in gen_conf:
- _gen_conf["Temperature"] = gen_conf["temperature"]
- if "top_p" in gen_conf:
- _gen_conf["TopP"] = gen_conf["top_p"]
- return _gen_conf
-
- def _chat(self, history, gen_conf={}, **kwargs):
- from tencentcloud.hunyuan.v20230901 import models
-
- hist = [{k.capitalize(): v for k, v in item.items()} for item in history]
- req = models.ChatCompletionsRequest()
- params = {"Model": self.model_name, "Messages": hist, **gen_conf}
- req.from_json_string(json.dumps(params))
- response = self.client.ChatCompletions(req)
- ans = response.Choices[0].Message.Content
- return ans, response.Usage.TotalTokens
-
- def chat_streamly(self, system, history, gen_conf={}, **kwargs):
- from tencentcloud.common.exception.tencent_cloud_sdk_exception import (
- TencentCloudSDKException,
- )
- from tencentcloud.hunyuan.v20230901 import models
-
- _gen_conf = {}
- _history = [{k.capitalize(): v for k, v in item.items()} for item in history]
- if system and history and history[0].get("role") != "system":
- _history.insert(0, {"Role": "system", "Content": system})
- if "max_tokens" in gen_conf:
- del gen_conf["max_tokens"]
- if "temperature" in gen_conf:
- _gen_conf["Temperature"] = gen_conf["temperature"]
- if "top_p" in gen_conf:
- _gen_conf["TopP"] = gen_conf["top_p"]
- req = models.ChatCompletionsRequest()
- params = {
- "Model": self.model_name,
- "Messages": _history,
- "Stream": True,
- **_gen_conf,
- }
- req.from_json_string(json.dumps(params))
- ans = ""
- total_tokens = 0
- try:
- response = self.client.ChatCompletions(req)
- for resp in response:
- resp = json.loads(resp["data"])
- if not resp["Choices"] or not resp["Choices"][0]["Delta"]["Content"]:
- continue
- ans = resp["Choices"][0]["Delta"]["Content"]
- total_tokens += 1
-
- yield ans
-
- except TencentCloudSDKException as e:
- yield ans + "\n**ERROR**: " + str(e)
-
- yield total_tokens
-
-
class SparkChat(Base):
_FACTORY_NAME = "XunFei Spark"
@@ -1209,6 +1129,7 @@ class LiteLLMBase(ABC):
"GPUStack",
"OpenAI",
"Azure-OpenAI",
+ "Tencent Hunyuan",
]
def __init__(self, key, model_name, base_url=None, **kwargs):
@@ -1259,6 +1180,11 @@ class LiteLLMBase(ABC):
return LLMErrorCode.ERROR_GENERIC
def _clean_conf(self, gen_conf):
+ if self.provider == SupportedLiteLLMProvider.HunYuan:
+ unsupported = ["presence_penalty", "frequency_penalty"]
+ for key in unsupported:
+ gen_conf.pop(key, None)
+
if "max_tokens" in gen_conf:
del gen_conf["max_tokens"]
return gen_conf
@@ -1704,3 +1630,4 @@ class LiteLLMBase(ABC):
if extra_headers:
completion_args["extra_headers"] = extra_headers
return completion_args
+
diff --git a/web/src/locales/de.ts b/web/src/locales/de.ts
index 37b7d98611..d2ee04c70c 100644
--- a/web/src/locales/de.ts
+++ b/web/src/locales/de.ts
@@ -1226,10 +1226,6 @@ Beispiel: Virtual Hosted Style`,
'sa-east-1': 'Südamerika (São Paulo)',
'us-gov-east-1': 'AWS GovCloud (US-Ost)',
'us-gov-west-1': 'AWS GovCloud (US-West)',
- addHunyuanSID: 'Hunyuan Secret ID',
- HunyuanSIDMessage: 'Bitte geben Sie Ihre Secret ID ein',
- addHunyuanSK: 'Hunyuan Secret Key',
- HunyuanSKMessage: 'Bitte geben Sie Ihren Secret Key ein',
addTencentCloudSID: 'TencentCloud Secret ID',
TencentCloudSIDMessage: 'Bitte geben Sie Ihre Secret ID ein',
addTencentCloudSK: 'TencentCloud Secret Key',
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index c2de2d8ccf..ac762f155a 100644
--- a/web/src/locales/en.ts
+++ b/web/src/locales/en.ts
@@ -1178,10 +1178,6 @@ Example: Virtual Hosted Style`,
'sa-east-1': 'South America (São Paulo)',
'us-gov-east-1': 'AWS GovCloud (US-East)',
'us-gov-west-1': 'AWS GovCloud (US-West)',
- addHunyuanSID: 'Hunyuan Secret ID',
- HunyuanSIDMessage: 'Please input your Secret ID',
- addHunyuanSK: 'Hunyuan Secret Key',
- HunyuanSKMessage: 'Please input your Secret Key',
addTencentCloudSID: 'TencentCloud Secret ID',
TencentCloudSIDMessage: 'Please input your Secret ID',
addTencentCloudSK: 'TencentCloud Secret Key',
diff --git a/web/src/locales/es.ts b/web/src/locales/es.ts
index a94caea81a..c2cce34204 100644
--- a/web/src/locales/es.ts
+++ b/web/src/locales/es.ts
@@ -162,13 +162,16 @@ export default {
knowledgeConfiguration: {
paddleocrOptions: 'Opciones de PaddleOCR',
paddleocrApiUrl: 'URL de API de PaddleOCR',
- paddleocrApiUrlTip: 'La URL del endpoint de la API para el servicio PaddleOCR',
+ paddleocrApiUrlTip:
+ 'La URL del endpoint de la API para el servicio PaddleOCR',
paddleocrApiUrlPlaceholder: 'ej: https://servidor-paddleocr.com/api',
paddleocrAccessToken: 'Token de acceso de AI Studio',
- paddleocrAccessTokenTip: 'Token de acceso para la API de PaddleOCR (opcional)',
+ paddleocrAccessTokenTip:
+ 'Token de acceso para la API de PaddleOCR (opcional)',
paddleocrAccessTokenPlaceholder: 'Su token de AI Studio (opcional)',
paddleocrAlgorithm: 'Algoritmo de PaddleOCR',
- paddleocrAlgorithmTip: 'Algoritmo a utilizar para el análisis de PaddleOCR',
+ paddleocrAlgorithmTip:
+ 'Algoritmo a utilizar para el análisis de PaddleOCR',
paddleocrSelectAlgorithm: 'Seleccionar algoritmo',
paddleocrModelNamePlaceholder: 'ej: paddleocr-desde-env-1',
},
@@ -395,14 +398,15 @@ export default {
baseUrlNameMessage: '¡Por favor ingresa tu URL base!',
paddleocr: {
apiUrl: 'URL de la API de PaddleOCR',
- apiUrlPlaceholder: 'Por ejemplo: https://paddleocr-server.com/layout-parsing',
+ apiUrlPlaceholder:
+ 'Por ejemplo: https://paddleocr-server.com/layout-parsing',
accessToken: 'Token de acceso de AI Studio',
accessTokenPlaceholder: 'Su token de AI Studio (opcional)',
algorithm: 'Algoritmo de PaddleOCR',
selectAlgorithm: 'Seleccionar algoritmo',
modelNamePlaceholder: 'Por ejemplo: paddleocr-from-env-1',
modelNameRequired: 'El nombre del modelo es obligatorio',
- apiUrlRequired: 'La URL de la API de PaddleOCR es obligatoria'
+ apiUrlRequired: 'La URL de la API de PaddleOCR es obligatoria',
},
vision: '¿Soporta visión?',
ollamaLink: 'Cómo integrar {{name}}',
@@ -427,10 +431,6 @@ export default {
'eu-central-1': 'Europa (Frankfurt)',
'us-gov-west-1': 'AWS GovCloud (EE. UU. Oeste)',
'ap-southeast-2': 'Asia Pacífico (Sídney)',
- addHunyuanSID: 'ID Secreto de Hunyuan',
- HunyuanSIDMessage: '¡Por favor ingresa tu ID Secreto!',
- addHunyuanSK: 'Clave Secreta de Hunyuan',
- HunyuanSKMessage: '¡Por favor ingresa tu Clave Secreta!',
addTencentCloudSID: 'ID Secreto de TencentCloud',
TencentCloudSIDMessage: '¡Por favor ingresa tu ID Secreto!',
addTencentCloudSK: 'Clave Secreta de TencentCloud',
diff --git a/web/src/locales/fr.ts b/web/src/locales/fr.ts
index d89a69e4ac..942b8f79e9 100644
--- a/web/src/locales/fr.ts
+++ b/web/src/locales/fr.ts
@@ -295,8 +295,10 @@ export default {
'Le document en cours d’analyse ne peut pas être supprimé',
paddleocrOptions: 'Options PaddleOCR',
paddleocrApiUrl: 'URL de l’API PaddleOCR',
- paddleocrApiUrlTip: 'URL du point de terminaison de l’API du service PaddleOCR',
- paddleocrApiUrlPlaceholder: 'Par exemple : https://paddleocr-server.com/layout-parsing',
+ paddleocrApiUrlTip:
+ 'URL du point de terminaison de l’API du service PaddleOCR',
+ paddleocrApiUrlPlaceholder:
+ 'Par exemple : https://paddleocr-server.com/layout-parsing',
paddleocrAccessToken: 'Jeton d’accès AI Studio',
paddleocrAccessTokenTip: 'Jeton d’accès à l’API PaddleOCR (optionnel)',
paddleocrAccessTokenPlaceholder: 'Votre jeton AI Studio (optionnel)',
@@ -579,14 +581,15 @@ export default {
baseUrlNameMessage: 'Veuillez saisir votre URL de base !',
paddleocr: {
apiUrl: 'URL de l’API PaddleOCR',
- apiUrlPlaceholder: 'Par exemple : https://paddleocr-server.com/layout-parsing',
+ apiUrlPlaceholder:
+ 'Par exemple : https://paddleocr-server.com/layout-parsing',
accessToken: 'Jeton d’accès AI Studio',
accessTokenPlaceholder: 'Votre jeton AI Studio (optionnel)',
algorithm: 'Algorithme PaddleOCR',
selectAlgorithm: 'Sélectionner un algorithme',
modelNamePlaceholder: 'Par exemple : paddleocr-from-env-1',
modelNameRequired: 'Le nom du modèle est obligatoire',
- apiUrlRequired: 'L’URL de l’API PaddleOCR est obligatoire'
+ apiUrlRequired: 'L’URL de l’API PaddleOCR est obligatoire',
},
vision: 'Supporte-t-il la vision ?',
ollamaLink: 'Comment intégrer {{name}}',
@@ -611,10 +614,6 @@ export default {
'eu-central-1': 'Europe (Francfort)',
'us-gov-west-1': 'AWS GovCloud (US-Ouest)',
'ap-southeast-2': 'Asie Pacifique (Sydney)',
- addHunyuanSID: 'ID secret Hunyuan',
- HunyuanSIDMessage: 'Veuillez saisir votre ID secret',
- addHunyuanSK: 'Clé secrète Hunyuan',
- HunyuanSKMessage: 'Veuillez saisir votre clé secrète',
addTencentCloudSID: 'ID secret TencentCloud',
TencentCloudSIDMessage: 'Veuillez saisir votre ID secret',
addTencentCloudSK: 'Clé secrète TencentCloud',
diff --git a/web/src/locales/id.ts b/web/src/locales/id.ts
index 975760941b..4ed764c4b8 100644
--- a/web/src/locales/id.ts
+++ b/web/src/locales/id.ts
@@ -319,12 +319,14 @@ export default {
paddleocrOptions: 'Opsi PaddleOCR',
paddleocrApiUrl: 'URL API PaddleOCR',
paddleocrApiUrlTip: 'URL endpoint API layanan PaddleOCR',
- paddleocrApiUrlPlaceholder: 'Contoh: https://paddleocr-server.com/layout-parsing',
+ paddleocrApiUrlPlaceholder:
+ 'Contoh: https://paddleocr-server.com/layout-parsing',
paddleocrAccessToken: 'Token Akses AI Studio',
paddleocrAccessTokenTip: 'Token akses untuk API PaddleOCR (opsional)',
paddleocrAccessTokenPlaceholder: 'Token AI Studio Anda (opsional)',
paddleocrAlgorithm: 'Algoritma PaddleOCR',
- paddleocrAlgorithmTip: 'Algoritma yang digunakan untuk pemrosesan PaddleOCR',
+ paddleocrAlgorithmTip:
+ 'Algoritma yang digunakan untuk pemrosesan PaddleOCR',
paddleocrSelectAlgorithm: 'Pilih algoritma',
paddleocrModelNamePlaceholder: 'Contoh: paddleocr-lingkungan-1',
},
@@ -566,14 +568,15 @@ export default {
baseUrlNameMessage: 'Silakan masukkan base url Anda!',
paddleocr: {
apiUrl: 'URL API PaddleOCR',
- apiUrlPlaceholder: 'Contoh: https://paddleocr-server.com/layout-parsing',
+ apiUrlPlaceholder:
+ 'Contoh: https://paddleocr-server.com/layout-parsing',
accessToken: 'Token Akses AI Studio',
accessTokenPlaceholder: 'Token AI Studio Anda (opsional)',
algorithm: 'Algoritma PaddleOCR',
selectAlgorithm: 'Pilih algoritma',
modelNamePlaceholder: 'Contoh: paddleocr-from-env-1',
modelNameRequired: 'Nama model wajib diisi',
- apiUrlRequired: 'URL API PaddleOCR wajib diisi'
+ apiUrlRequired: 'URL API PaddleOCR wajib diisi',
},
vision: 'Apakah mendukung Vision?',
ollamaLink: 'Cara mengintegrasikan {{name}}',
@@ -626,10 +629,6 @@ export default {
'sa-east-1': 'South America (São Paulo)',
'us-gov-east-1': 'AWS GovCloud (US-East)',
'us-gov-west-1': 'AWS GovCloud (US-West)',
- addHunyuanSID: 'Hunyuan Secret ID',
- HunyuanSIDMessage: 'Silakan masukkan Secret ID Anda',
- addHunyuanSK: 'Hunyuan Secret Key',
- HunyuanSKMessage: 'Silakan masukkan Secret Key Anda',
addTencentCloudSID: 'TencentCloud Secret ID',
TencentCloudSIDMessage: 'Silakan masukkan Secret ID Anda',
addTencentCloudSK: 'TencentCloud Secret Key',
diff --git a/web/src/locales/ja.ts b/web/src/locales/ja.ts
index 5b10f3596d..f7450dd9d9 100644
--- a/web/src/locales/ja.ts
+++ b/web/src/locales/ja.ts
@@ -616,7 +616,7 @@ export default {
selectAlgorithm: 'アルゴリズムを選択',
modelNamePlaceholder: '例:paddleocr-from-env-1',
modelNameRequired: 'モデル名は必須です',
- apiUrlRequired: 'PaddleOCR API URL は必須です'
+ apiUrlRequired: 'PaddleOCR API URL は必須です',
},
vision: 'ビジョンをサポートしていますか?',
ollamaLink: '{{name}}を統合する方法',
@@ -641,10 +641,6 @@ export default {
'eu-central-1': 'ヨーロッパ(フランクフルト)',
'us-gov-west-1': 'AWS GovCloud(米国西部)',
'ap-southeast-2': 'アジア太平洋(シドニー)',
- addHunyuanSID: 'HunyuanシークレットID',
- HunyuanSIDMessage: 'シークレットIDを入力してください',
- addHunyuanSK: 'Hunyuanシークレットキー',
- HunyuanSKMessage: 'シークレットキーを入力してください',
addTencentCloudSID: 'TencentCloudシークレットID',
TencentCloudSIDMessage: 'シークレットIDを入力してください',
addTencentCloudSK: 'TencentCloudシークレットキー',
diff --git a/web/src/locales/pt-br.ts b/web/src/locales/pt-br.ts
index d5df6fd817..dfcb5525c1 100644
--- a/web/src/locales/pt-br.ts
+++ b/web/src/locales/pt-br.ts
@@ -315,10 +315,12 @@ export default {
paddleocrApiUrlTip: 'A URL do endpoint da API para o serviço PaddleOCR',
paddleocrApiUrlPlaceholder: 'ex: https://servidor-paddleocr.com/api',
paddleocrAccessToken: 'Token de Acesso do AI Studio',
- paddleocrAccessTokenTip: 'Token de acesso para a API do PaddleOCR (opcional)',
+ paddleocrAccessTokenTip:
+ 'Token de acesso para a API do PaddleOCR (opcional)',
paddleocrAccessTokenPlaceholder: 'Seu token do AI Studio (opcional)',
paddleocrAlgorithm: 'Algoritmo do PaddleOCR',
- paddleocrAlgorithmTip: 'Algoritmo a ser usado para a análise do PaddleOCR',
+ paddleocrAlgorithmTip:
+ 'Algoritmo a ser usado para a análise do PaddleOCR',
paddleocrSelectAlgorithm: 'Selecionar algoritmo',
paddleocrModelNamePlaceholder: 'ex: paddleocr-do-ambiente-1',
},
@@ -559,14 +561,15 @@ export default {
baseUrlNameMessage: 'Por favor, insira sua URL base!',
paddleocr: {
apiUrl: 'URL da API do PaddleOCR',
- apiUrlPlaceholder: 'Por exemplo: https://paddleocr-server.com/layout-parsing',
+ apiUrlPlaceholder:
+ 'Por exemplo: https://paddleocr-server.com/layout-parsing',
accessToken: 'Token de acesso do AI Studio',
accessTokenPlaceholder: 'Seu token do AI Studio (opcional)',
algorithm: 'Algoritmo do PaddleOCR',
selectAlgorithm: 'Selecionar algoritmo',
modelNamePlaceholder: 'Por exemplo: paddleocr-from-env-1',
modelNameRequired: 'O nome do modelo é obrigatório',
- apiUrlRequired: 'A URL da API do PaddleOCR é obrigatória'
+ apiUrlRequired: 'A URL da API do PaddleOCR é obrigatória',
},
vision: 'Suporta visão?',
ollamaLink: 'Como integrar {{name}}',
@@ -591,10 +594,6 @@ export default {
'eu-central-1': 'Europa (Frankfurt)',
'us-gov-west-1': 'AWS GovCloud (EUA-Oeste)',
'ap-southeast-2': 'Ásia-Pacífico (Sydney)',
- addHunyuanSID: 'Hunyuan Secret ID',
- HunyuanSIDMessage: 'Por favor, insira seu Secret ID',
- addHunyuanSK: 'Hunyuan Secret Key',
- HunyuanSKMessage: 'Por favor, insira sua Secret Key',
addTencentCloudSID: 'TencentCloud Secret ID',
TencentCloudSIDMessage: 'Por favor, insira seu Secret ID',
addTencentCloudSK: 'TencentCloud Secret Key',
diff --git a/web/src/locales/ru.ts b/web/src/locales/ru.ts
index 4e676ddcef..945c0c01b4 100644
--- a/web/src/locales/ru.ts
+++ b/web/src/locales/ru.ts
@@ -513,7 +513,8 @@ export default {
paddleocrOptions: 'Параметры PaddleOCR',
paddleocrApiUrl: 'URL API PaddleOCR',
paddleocrApiUrlTip: 'URL конечной точки API сервиса PaddleOCR',
- paddleocrApiUrlPlaceholder: 'Например: https://paddleocr-server.com/layout-parsing',
+ paddleocrApiUrlPlaceholder:
+ 'Например: https://paddleocr-server.com/layout-parsing',
paddleocrAccessToken: 'Токен доступа AI Studio',
paddleocrAccessTokenTip: 'Токен доступа к API PaddleOCR (необязательно)',
paddleocrAccessTokenPlaceholder: 'Ваш токен AI Studio (необязательно)',
@@ -979,10 +980,6 @@ export default {
'sa-east-1': 'Южная Америка (Сан-Паулу)',
'us-gov-east-1': 'AWS GovCloud (US-East)',
'us-gov-west-1': 'AWS GovCloud (US-West)',
- addHunyuanSID: 'Hunyuan Secret ID',
- HunyuanSIDMessage: 'Пожалуйста, введите ваш Secret ID',
- addHunyuanSK: 'Hunyuan Secret Key',
- HunyuanSKMessage: 'Пожалуйста, введите ваш Secret Key',
addTencentCloudSID: 'TencentCloud Secret ID',
TencentCloudSIDMessage: 'Пожалуйста, введите ваш Secret ID',
addTencentCloudSK: 'TencentCloud Secret Key',
@@ -1047,14 +1044,15 @@ export default {
mcp: 'MCP',
paddleocr: {
apiUrl: 'URL API PaddleOCR',
- apiUrlPlaceholder: 'Например: https://paddleocr-server.com/layout-parsing',
+ apiUrlPlaceholder:
+ 'Например: https://paddleocr-server.com/layout-parsing',
accessToken: 'Токен доступа AI Studio',
accessTokenPlaceholder: 'Ваш токен AI Studio (необязательно)',
algorithm: 'Алгоритм PaddleOCR',
selectAlgorithm: 'Выбрать алгоритм',
modelNamePlaceholder: 'Например: paddleocr-from-env-1',
modelNameRequired: 'Имя модели является обязательным',
- apiUrlRequired: 'URL API PaddleOCR является обязательным'
+ apiUrlRequired: 'URL API PaddleOCR является обязательным',
},
},
message: {
diff --git a/web/src/locales/vi.ts b/web/src/locales/vi.ts
index 1c831f57b1..3a1f169cc6 100644
--- a/web/src/locales/vi.ts
+++ b/web/src/locales/vi.ts
@@ -357,7 +357,8 @@ export default {
paddleocrOptions: 'Tùy chọn PaddleOCR',
paddleocrApiUrl: 'URL API PaddleOCR',
paddleocrApiUrlTip: 'URL điểm cuối API của dịch vụ PaddleOCR',
- paddleocrApiUrlPlaceholder: 'Ví dụ: https://paddleocr-server.com/layout-parsing',
+ paddleocrApiUrlPlaceholder:
+ 'Ví dụ: https://paddleocr-server.com/layout-parsing',
paddleocrAccessToken: 'Token truy cập AI Studio',
paddleocrAccessTokenTip: 'Token truy cập cho API PaddleOCR (tùy chọn)',
paddleocrAccessTokenPlaceholder: 'Token AI Studio của bạn (tùy chọn)',
@@ -615,7 +616,7 @@ export default {
selectAlgorithm: 'Chọn thuật toán',
modelNamePlaceholder: 'Ví dụ: paddleocr-from-env-1',
modelNameRequired: 'Tên mô hình là bắt buộc',
- apiUrlRequired: 'URL API PaddleOCR là bắt buộc'
+ apiUrlRequired: 'URL API PaddleOCR là bắt buộc',
},
vision: 'Có hỗ trợ Tầm nhìn không?',
ollamaLink: 'Cách tích hợp {{name}}',
@@ -667,10 +668,6 @@ export default {
'sa-east-1': 'South America (São Paulo)',
'us-gov-east-1': 'AWS GovCloud (US-East)',
'us-gov-west-1': 'AWS GovCloud (US-West)',
- addHunyuanSID: 'Hunyuan Secret ID',
- HunyuanSIDMessage: 'Vui lòng nhập ID bí mật của bạn',
- addHunyuanSK: 'Hunyuan Secret Key',
- HunyuanSKMessage: 'Vui lòng nhập Khóa bí mật của bạn',
addTencentCloudSID: 'TencentCloud Secret ID',
TencentCloudSIDMessage: 'Vui lòng nhập ID bí mật của bạn',
addTencentCloudSK: 'TencentCloud Secret Key',
diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts
index 30dcde85d4..fd48cc25b2 100644
--- a/web/src/locales/zh-traditional.ts
+++ b/web/src/locales/zh-traditional.ts
@@ -692,10 +692,6 @@ export default {
'eu-central-1': '歐洲 (法蘭克福)',
'us-gov-west-1': 'AWS GovCloud (US-West)',
'ap-southeast-2': '亞太地區 (雪梨)',
- addHunyuanSID: '混元 Secret ID',
- HunyuanSIDMessage: '請輸入 Secret ID',
- addHunyuanSK: '混元 Secret Key',
- HunyuanSKMessage: '請輸入 Secret Key',
addTencentCloudSID: '騰訊雲 Secret ID',
TencentCloudSIDMessage: '請輸入 Secret ID',
addTencentCloudSK: '騰訊雲 Secret Key',
diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts
index ec72b7f738..8c55a44ce8 100644
--- a/web/src/locales/zh.ts
+++ b/web/src/locales/zh.ts
@@ -1051,10 +1051,6 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于
'eu-central-1': '欧洲 (法兰克福)',
'us-gov-west-1': 'AWS GovCloud (US-West)',
'ap-southeast-2': '亚太地区 (悉尼)',
- addHunyuanSID: '混元 Secret ID',
- HunyuanSIDMessage: '请输入 Secret ID',
- addHunyuanSK: '混元 Secret Key',
- HunyuanSKMessage: '请输入 Secret Key',
addTencentCloudSID: '腾讯云 Secret ID',
TencentCloudSIDMessage: '请输入 Secret ID',
addTencentCloudSK: '腾讯云 Secret Key',
diff --git a/web/src/pages/user-setting/setting-model/hooks.tsx b/web/src/pages/user-setting/setting-model/hooks.tsx
index 68d73326ac..bb46c6bc83 100644
--- a/web/src/pages/user-setting/setting-model/hooks.tsx
+++ b/web/src/pages/user-setting/setting-model/hooks.tsx
@@ -206,33 +206,6 @@ export const useSubmitVolcEngine = () => {
};
};
-export const useSubmitHunyuan = () => {
- const { addLlm, loading } = useAddLlm();
- const {
- visible: HunyuanAddingVisible,
- hideModal: hideHunyuanAddingModal,
- showModal: showHunyuanAddingModal,
- } = useSetModalState();
-
- const onHunyuanAddingOk = useCallback(
- async (payload: IAddLlmRequestBody) => {
- const ret = await addLlm(payload);
- if (ret === 0) {
- hideHunyuanAddingModal();
- }
- },
- [hideHunyuanAddingModal, addLlm],
- );
-
- return {
- HunyuanAddingLoading: loading,
- onHunyuanAddingOk,
- HunyuanAddingVisible,
- hideHunyuanAddingModal,
- showHunyuanAddingModal,
- };
-};
-
export const useSubmitTencentCloud = () => {
const { addLlm, loading } = useAddLlm();
const {
diff --git a/web/src/pages/user-setting/setting-model/index.tsx b/web/src/pages/user-setting/setting-model/index.tsx
index 41224a16aa..46e77f738f 100644
--- a/web/src/pages/user-setting/setting-model/index.tsx
+++ b/web/src/pages/user-setting/setting-model/index.tsx
@@ -12,7 +12,6 @@ import {
useSubmitBedrock,
useSubmitFishAudio,
useSubmitGoogle,
- useSubmitHunyuan,
useSubmitMinerU,
useSubmitOllama,
useSubmitPaddleOCR,
@@ -27,11 +26,10 @@ import AzureOpenAIModal from './modal/azure-openai-modal';
import BedrockModal from './modal/bedrock-modal';
import FishAudioModal from './modal/fish-audio-modal';
import GoogleModal from './modal/google-modal';
-import HunyuanModal from './modal/hunyuan-modal';
import MinerUModal from './modal/mineru-modal';
-import PaddleOCRModal from './modal/paddleocr-modal';
import TencentCloudModal from './modal/next-tencent-modal';
import OllamaModal from './modal/ollama-modal';
+import PaddleOCRModal from './modal/paddleocr-modal';
import SparkModal from './modal/spark-modal';
import VolcEngineModal from './modal/volcengine-modal';
import YiyanModal from './modal/yiyan-modal';
@@ -68,14 +66,6 @@ const ModelProviders = () => {
volcAddingLoading,
} = useSubmitVolcEngine();
- const {
- HunyuanAddingVisible,
- hideHunyuanAddingModal,
- showHunyuanAddingModal,
- onHunyuanAddingOk,
- HunyuanAddingLoading,
- } = useSubmitHunyuan();
-
const {
GoogleAddingVisible,
hideGoogleAddingModal,
@@ -152,7 +142,6 @@ const ModelProviders = () => {
() => ({
[LLMFactory.Bedrock]: showBedrockAddingModal,
[LLMFactory.VolcEngine]: showVolcAddingModal,
- [LLMFactory.TencentHunYuan]: showHunyuanAddingModal,
[LLMFactory.XunFeiSpark]: showSparkAddingModal,
[LLMFactory.BaiduYiYan]: showyiyanAddingModal,
[LLMFactory.FishAudio]: showFishAudioAddingModal,
@@ -165,7 +154,6 @@ const ModelProviders = () => {
[
showBedrockAddingModal,
showVolcAddingModal,
- showHunyuanAddingModal,
showSparkAddingModal,
showyiyanAddingModal,
showFishAudioAddingModal,
@@ -259,13 +247,6 @@ const ModelProviders = () => {
loading={volcAddingLoading}
llmFactory={LLMFactory.VolcEngine}
></VolcEngineModal>
- <HunyuanModal
- visible={HunyuanAddingVisible}
- hideModal={hideHunyuanAddingModal}
- onOk={onHunyuanAddingOk}
- loading={HunyuanAddingLoading}
- llmFactory={LLMFactory.TencentHunYuan}
- ></HunyuanModal>
<GoogleModal
visible={GoogleAddingVisible}
hideModal={hideGoogleAddingModal}
diff --git a/web/src/pages/user-setting/setting-model/modal/hunyuan-modal/index.tsx b/web/src/pages/user-setting/setting-model/modal/hunyuan-modal/index.tsx
deleted file mode 100644
index 30c1fbd509..0000000000
--- a/web/src/pages/user-setting/setting-model/modal/hunyuan-modal/index.tsx
+++ /dev/null
@@ -1,91 +0,0 @@
-import {
- DynamicForm,
- FormFieldConfig,
- FormFieldType,
-} from '@/components/dynamic-form';
-import { Modal } from '@/components/ui/modal/modal';
-import { useCommonTranslation, useTranslate } from '@/hooks/common-hooks';
-import { IModalProps } from '@/interfaces/common';
-import { IAddLlmRequestBody } from '@/interfaces/request/llm';
-import { FieldValues } from 'react-hook-form';
-import { LLMHeader } from '../../components/llm-header';
-
-const HunyuanModal = ({
- visible,
- hideModal,
- onOk,
- loading,
- llmFactory,
-}: IModalProps<IAddLlmRequestBody> & { llmFactory: string }) => {
- const { t } = useTranslate('setting');
- const { t: tc } = useCommonTranslation();
-
- const fields: FormFieldConfig[] = [
- {
- name: 'hunyuan_sid',
- label: t('addHunyuanSID'),
- type: FormFieldType.Text,
- required: true,
- placeholder: t('HunyuanSIDMessage'),
- validation: {
- message: t('HunyuanSIDMessage'),
- },
- },
- {
- name: 'hunyuan_sk',
- label: t('addHunyuanSK'),
- type: FormFieldType.Text,
- required: true,
- placeholder: t('HunyuanSKMessage'),
- validation: {
- message: t('HunyuanSKMessage'),
- },
- },
- ];
-
- const handleOk = async (values?: FieldValues) => {
- if (!values) return;
-
- const data = {
- hunyuan_sid: values.hunyuan_sid as string,
- hunyuan_sk: values.hunyuan_sk as string,
- llm_factory: llmFactory,
- } as unknown as IAddLlmRequestBody;
-
- await onOk?.(data);
- };
-
- return (
- <Modal
- title={<LLMHeader name={llmFactory} />}
- open={visible || false}
- onOpenChange={(open) => !open && hideModal?.()}
- maskClosable={false}
- footer={<div className="p-4"></div>}
- className="max-w-[600px]"
- >
- <DynamicForm.Root
- fields={fields}
- onSubmit={() => {}}
- labelClassName="font-normal"
- >
- <div className="absolute bottom-0 right-0 left-0 flex items-center justify-end w-full gap-2 py-6 px-6">
- <DynamicForm.CancelButton
- handleCancel={() => {
- hideModal?.();
- }}
- />
- <DynamicForm.SavingButton
- submitLoading={loading || false}
- buttonText={tc('ok')}
- submitFunc={(values: FieldValues) => {
- handleOk(values);
- }}
- />
- </div>
- </DynamicForm.Root>
- </Modal>
- );
-};
-
-export default HunyuanModal;