Stabilize pro editing without heavy office runtime
The workspace now carries the pro editing flow, streaming completion path, and lighter Office preview state as one checkpoint so the remote has the current runnable project shape. Constraint: Preserve the current workspace as a single reviewable project commit while excluding local agent state and verification artifacts. Removed stale Univer runtime dependencies from the lockfile so installs match package.json. Rejected: Commit runtime screenshots, .omx state, and coverage files | they are local artifacts rather than source state. Confidence: medium Scope-risk: broad Directive: Keep package.json and package-lock.json synchronized when changing frontend dependencies. Tested: npm run build; C:\Users\ydy\.conda\envs\llmwebsite\python.exe -m pytest backend/tests/test_main_endpoints.py backend/tests/test_main_cancel.py backend/tests/test_llm.py backend/tests/test_llm_extended.py -v -o addopts= (44 passed). Not-tested: Full pytest with repository coverage addopts currently reports 0% coverage because pytest-cov watches backend.* module names while tests import top-level backend modules. Co-authored-by: OmX <omx@oh-my-codex.dev>
This commit is contained in:
+12
-15
@@ -19,11 +19,11 @@ except ModuleNotFoundError:
|
||||
def test_call_ollama_messages_roles_with_system(monkeypatch):
|
||||
captured = {}
|
||||
|
||||
async def fake_chat(**kwargs):
|
||||
captured["messages"] = kwargs["messages"]
|
||||
return {"message": {"content": "ok", "thinking": ""}}
|
||||
async def fake_generate(**kwargs):
|
||||
captured["kwargs"] = kwargs
|
||||
return {"response": "ok"}
|
||||
|
||||
monkeypatch.setattr(llm.client, "chat", fake_chat)
|
||||
monkeypatch.setattr(llm.client, "generate", fake_generate)
|
||||
|
||||
result = asyncio.run(
|
||||
llm.call_ollama(
|
||||
@@ -35,20 +35,18 @@ def test_call_ollama_messages_roles_with_system(monkeypatch):
|
||||
)
|
||||
|
||||
assert result["content"] == "ok"
|
||||
assert captured["messages"][0]["role"] == "system"
|
||||
assert captured["messages"][0]["content"] == "system prompt body"
|
||||
assert captured["messages"][1]["role"] == "user"
|
||||
assert captured["messages"][1]["content"] == "user prompt body"
|
||||
assert captured["kwargs"]["prompt"] == "system prompt body\n\nuser prompt body"
|
||||
assert captured["kwargs"]["raw"] is True
|
||||
|
||||
|
||||
def test_call_ollama_messages_roles_without_system(monkeypatch):
|
||||
captured = {}
|
||||
|
||||
async def fake_chat(**kwargs):
|
||||
captured["messages"] = kwargs["messages"]
|
||||
return {"message": {"content": "ok", "thinking": ""}}
|
||||
async def fake_generate(**kwargs):
|
||||
captured["kwargs"] = kwargs
|
||||
return {"response": "ok"}
|
||||
|
||||
monkeypatch.setattr(llm.client, "chat", fake_chat)
|
||||
monkeypatch.setattr(llm.client, "generate", fake_generate)
|
||||
|
||||
result = asyncio.run(
|
||||
llm.call_ollama(
|
||||
@@ -60,6 +58,5 @@ def test_call_ollama_messages_roles_without_system(monkeypatch):
|
||||
)
|
||||
|
||||
assert result["content"] == "ok"
|
||||
assert len(captured["messages"]) == 1
|
||||
assert captured["messages"][0]["role"] == "user"
|
||||
assert captured["messages"][0]["content"] == "user prompt only"
|
||||
assert captured["kwargs"]["prompt"] == "user prompt only"
|
||||
assert captured["kwargs"]["raw"] is True
|
||||
|
||||
Reference in New Issue
Block a user