Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat: support chatglm_turbo model #1443 (#1460)

takatost4dfbcd0b4e61
diff --git a/api/core/model_providers/providers/zhipuai_provider.py b/api/core/model_providers/providers/zhipuai_provider.py
index 9b56851688b..2a7a0f65e04 100644
--- a/api/core/model_providers/providers/zhipuai_provider.py
+++ b/api/core/model_providers/providers/zhipuai_provider.py
@@ -26,6 +26,11 @@ class ZhipuAIProvider(BaseModelProvider):
def _get_fixed_model_list(self, model_type: ModelType) -> list[dict]:
if model_type == ModelType.TEXT_GENERATION:
return [
+ {
+ 'id': 'chatglm_turbo',
+ 'name': 'chatglm_turbo',
+ 'mode': ModelMode.CHAT.value,
+ },
{
'id': 'chatglm_pro',
'name': 'chatglm_pro',
diff --git a/api/core/model_providers/rules/zhipuai.json b/api/core/model_providers/rules/zhipuai.json
index 4a258a8a6ad..af0e5debbab 100644
--- a/api/core/model_providers/rules/zhipuai.json
+++ b/api/core/model_providers/rules/zhipuai.json
@@ -11,6 +11,12 @@
},
"model_flexibility": "fixed",
"price_config": {
+ "chatglm_turbo": {
+ "prompt": "0.005",
+ "completion": "0.005",
+ "unit": "0.001",
+ "currency": "RMB"
+ },
"chatglm_pro": {
"prompt": "0.01",
"completion": "0.01",
diff --git a/api/core/third_party/langchain/llms/zhipuai_llm.py b/api/core/third_party/langchain/llms/zhipuai_llm.py
index 06016f8c1c0..fb58c8f8c36 100644
--- a/api/core/third_party/langchain/llms/zhipuai_llm.py
+++ b/api/core/third_party/langchain/llms/zhipuai_llm.py
@@ -96,7 +96,7 @@ class ZhipuAIChatLLM(BaseChatModel):
return True
client: Any = None #: :meta private:
- model: str = "chatglm_lite"
+ model: str = "chatglm_turbo"
"""Model name to use."""
temperature: float = 0.95
"""A non-negative float that tunes the degree of randomness in generation."""