fix(service-ai): resolve current object for AI chat across languages#1815
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ck 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>
os-zhuang
added a commit
that referenced
this pull request
Jun 20, 2026
objectui #1815 fixed page:card-in-region (the layout div was shadowing the real renderer). Restore the My Work sidebar to use `page:card`: • a Shortcuts card (title + children list); • an admin-only Leadership card gated by `visible: user.email == …`. Both render title + body and the role gate hides for non-matching users. Browser-verified on :5181. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On a runtime object page (e.g.
…/showcase_app/showcase_task), asking the console assistant to analyse this object returned "can't find the X object" — most visibly for non-English prompts. Three compounding gaps:SchemaRetriever.tokenise()matched only[a-z0-9]+, so a Chinese request (分析任务对象) produced zero terms →query_datareturned "No matching objects in metadata".describe_object/list_objectsare cloud-only (@objectstack/service-ai-studio), leavingquery_data's keyword match as the only object-resolution path.Changes
schema-retriever.ts—tokenise()now emits CJK single-char + bigram terms alongside Latin/digit runs.agent-runtime.ts— newbuildContextSchemaMessages()looks upcontext.objectNameand injects its schema into the system prompt, so "analyse this object" works with zero tool calls in any language. Both chat routes call it.specToolExecutionContextgainscurrentObjectName/currentViewName;agent-routes.ts+assistant-routes.tsthread them through, andquery_datafalls back to the current object when keyword retrieval is empty.Pairs with objectui
fix/ai-current-object-context, which sendscontext.objectNamefrom the current console route.Tests
New coverage: CJK retrieval, schema injection (4 cases),
query_datacurrent-object fallback (2 cases). 81 service-ai tests pass;spec+service-aibuild clean.🤖 Generated with Claude Code