feat: 新增预算费控模型与报销审批流引擎
后端新增预算费控服务和报销单审批流模块,引入申请人费用画像 算法,优化知识库 RAG 运行时和同步逻辑,完善报销单工作流常 量和明细同步,更新差旅报销规则电子表格,前端新增预算分析 组件和数字员工模型,完善审批对话框和洞察面板交互,优化侧 边栏和顶栏样式,补充单元测试。
This commit is contained in:
35
server/tests/test_knowledge_rag_runtime.py
Normal file
35
server/tests/test_knowledge_rag_runtime.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from app.services.knowledge_rag_runtime import (
|
||||
KnowledgeRagError,
|
||||
RuntimeModelConfig,
|
||||
_LightRagRuntime,
|
||||
)
|
||||
|
||||
|
||||
def test_embedding_probe_error_includes_model_context(monkeypatch) -> None:
|
||||
runtime = _LightRagRuntime.__new__(_LightRagRuntime)
|
||||
config = RuntimeModelConfig(
|
||||
slot="embedding",
|
||||
provider="GLM",
|
||||
model="Embedding-3",
|
||||
endpoint="https://open.bigmodel.cn/api/paas/v4/",
|
||||
api_key="token",
|
||||
capability="embedding",
|
||||
)
|
||||
|
||||
def fail_embeddings(*_args, **_kwargs):
|
||||
raise KnowledgeRagError("token expired")
|
||||
|
||||
monkeypatch.setattr(runtime, "_request_embeddings", fail_embeddings)
|
||||
|
||||
with pytest.raises(KnowledgeRagError) as exc_info:
|
||||
runtime._probe_embedding_dimension(config)
|
||||
|
||||
message = str(exc_info.value)
|
||||
assert "slot=embedding" in message
|
||||
assert "provider=GLM" in message
|
||||
assert "model=Embedding-3" in message
|
||||
assert "token expired" in message
|
||||
Reference in New Issue
Block a user