You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(service-ai): resolve current object for AI chat across languages (#1815)
* fix(service-ai): resolve current object for AI chat across languages
The console assistant reported "can't find the X object" when asked to
analyse the object on the current page — most visibly for non-English
prompts. Three compounding gaps:
- The keyword SchemaRetriever tokeniser dropped all CJK text, so a
Chinese request yielded zero terms and "No matching objects".
- describe_object/list_objects are cloud-only, leaving query_data's
keyword match as the only object-discovery path in the open edition.
- Nothing fed the current object's schema to the agent, so "this object"
couldn't be resolved without a lucky keyword hit.
Changes:
- SchemaRetriever.tokenise() now emits CJK single-char + bigram terms.
- AgentRuntime.buildContextSchemaMessages() injects the current object's
schema into the system prompt; both chat routes call it.
- ToolExecutionContext gains currentObjectName/currentViewName; routes
thread them through and query_data falls back to the current object
when keyword retrieval is empty.
Tests cover CJK retrieval, schema injection (4 cases), and the
query_data current-object fallback (2 cases). 81 service-ai tests pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(service-ai): add buildContextSchemaMessages to the quota-test mock runtime
The mock AgentRuntime in agent-chat-quota.test.ts didn't implement the new
buildContextSchemaMessages method, so the route's await on it threw and the
handler returned 500 instead of 200. Mirror the real runtime in the mock.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments