后端新增预算费控服务和报销单审批流模块,引入申请人费用画像 算法,优化知识库 RAG 运行时和同步逻辑,完善报销单工作流常 量和明细同步,更新差旅报销规则电子表格,前端新增预算分析 组件和数字员工模型,完善审批对话框和洞察面板交互,优化侧 边栏和顶栏样式,补充单元测试。
36 lines
1005 B
Python
36 lines
1005 B
Python
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
|