WeKnora/docs
lyingbug 2be7bd4063
fix(agent): search bound knowledge bases before answering, and pass suggested-question origins (#3400)
* fix(agent): search bound knowledge bases before answering, and pass suggested-question origins

A user picked the suggested question "为什么在比较图形时需要谨慎处理?"
and the agent answered in round 1 with no tool call, claiming it had
searched the knowledge base and found nothing, then explained misleading
statistical charts. The question had been generated from "Corners Don't
Look Like That: Regarding Screenspace Ambient Occlusion" in a bound base,
where "comparing graphs" means SSAO falloff curves.

Two things let that happen: the grounding prompt said "Stable general
explanations need no lookup", and nothing told the agent where the
question came from - the base in question had no profile, only two
recent titles in the directory, and the click sent the text alone.

Prompt
- With knowledge tools available, search bound bases before answering a
  question about a topic, even one that reads like general knowledge;
  directory profiles and recent titles cannot prove a base lacks it.
- The general-explanation exemption applies only without bound bases.
- Say you searched or found nothing only when a search tool ran.

Question origin
- Suggested questions from FAQ/document chunks also return knowledge_id.
- Picking one on the home or chat page sends question_origin
  {knowledge_base_id, knowledge_id} with that question only.
- The service keeps the origin only when its base is inside the turn's
  resolved scope and the document belongs to that base; it never
  changes the scope (unlike knowledge_base_ids, which narrows it).
- The engine renders it in runtime_context as <question_origin> with the
  base and document handles and a note to search it before answering.

* fix(agent): keep question origins across file/tag scopes and bind them to the send

Review follow-up for the suggested-question origin.

- Scope check: the origin was kept only when its base was in the resolved
  KB list, which is empty for file-only and tag-only scopes even though
  their bases are searched. It is now checked against SearchTargets after
  they are built; the document is kept only when a target for that base
  covers it (unfiltered base, or a document scope listing it).
  resolveQuestionOriginInfo re-checks SearchTargets, looks up the name of
  a base that is not in kbInfos, and the renderer omits an unknown name.
- Frontend: the origin travelled through module-level "pending" state, so
  a send that returned early (agent not ready, upload in progress,
  steering) left it behind and a second pick overwrote it. It now rides
  with the one send: triggerSend(text, options) -> createSession ->
  send-msg -> sendMsg / changeFirstQuery.
- RetrieveKBOnlyWhenMentioned: suggestions are still generated from the
  agent's bases, but picking one retrieved nothing. The origin now
  selects its base, as an @mention would, when the agent may read it.
- API sync: question_origin in docs/api/chat.md and swagger;
  QuestionOrigin on the Go SDK's KnowledgeQARequest/AgentQARequest and
  knowledge_id on SuggestedQuestion.
2026-09-18 17:00:47 +08:00
..
api fix(agent): search bound knowledge bases before answering, and pass suggested-question origins (#3400) 2026-09-18 17:00:47 +08:00
assets fix(milvus): support multilingual BM25 retrieval (#3235) 2026-09-14 19:18:24 +08:00
cloud-image docs(cloud-image): add cloud-agnostic image packaging scripts 2026-05-11 12:25:19 +08:00
dev fix: validate vector store connection addresses against SSRF policy 2026-06-04 15:26:56 +08:00
images fix(browser): align BrowserSkill 0.3.0 and repair task lifecycle 2026-09-17 11:54:12 +08:00
plans feat(faq): filter entries by enabled status (#3157) 2026-09-10 14:42:59 +08:00
poc/docker-sandbox feat(sandbox): Docker 后端支持会话级长驻容器与远程守护进程 2026-08-24 12:22:58 +08:00
wiki feat(datasource): add DingTalk Docs integration with safe sync and localization (#2313) 2026-09-14 19:53:29 +08:00
zh refactor(terminology): rename user-facing tenant labels to workspace 2026-07-14 16:14:43 +08:00
BUILTIN_MCP_SERVICES.md refactor(terminology): rename user-facing tenant labels to workspace 2026-07-14 16:14:43 +08:00
BUILTIN_MODELS.md feat(agent): keep long sandbox turns from truncating, overflowing, or rewriting files 2026-09-02 22:09:09 +08:00
CHUNKING.md fix(chunking): post-review polish — error surfacing + doc accuracy 2026-05-06 17:17:07 +08:00
IM集成开发文档.md feat(im): support reverse proxy for feishu websocket long connection (#2550) 2026-08-12 16:18:27 +08:00
KnowledgeGraph.md docs: fix 登陆 typo to 登录 2026-08-07 17:04:49 +08:00
LITE.md refactor(terminology): rename user-facing tenant labels to workspace 2026-07-14 16:14:43 +08:00
Langfuse集成.md feat(llm): add prompt-cache observability and wiki cache-friendly prompts 2026-07-23 19:17:30 +08:00
MCP功能使用说明.md refactor(terminology): rename user-facing tenant labels to workspace 2026-07-14 16:14:43 +08:00
OIDC认证调用流程.md refactor(terminology): rename user-facing tenant labels to workspace 2026-07-14 16:14:43 +08:00
QA.md feat(website): add product homepage and unified docs deployment (#3297) 2026-09-16 11:58:37 +08:00
RBAC说明.md docs: clarify workspace owner cardinality 2026-07-23 16:13:35 +08:00
ROADMAP.md feat(roadmap): update progress on document parsing and IM integration 2026-03-31 20:22:34 +08:00
agent-prompt-assembly.md feat(browser): polish connection settings, open tasks in a new window, and streamline prompts (#3193) 2026-09-11 21:28:58 +08:00
agent-skills.md feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
agent-tools-design.md feat(sandbox): run sandboxed execs as root by default (#3067) 2026-09-07 13:03:35 +08:00
browser-skill-integration.md fix(browser): align BrowserSkill 0.3.0 and repair task lifecycle 2026-09-17 11:54:12 +08:00
browser-skill-production.md fix(browser): align BrowserSkill 0.3.0 and repair task lifecycle 2026-09-17 11:54:12 +08:00
chat-steering.md fix(chat): preserve steering continuity and composer focus 2026-09-09 20:15:23 +08:00
client-integration-upgrade-notes.md fix: align client sessions and integration request handling (#3305) 2026-09-16 16:20:57 +08:00
code-slimming-audit.md refactor(frontend): consolidate knowledge tag filters and remove stale styles 2026-09-17 16:46:27 +08:00
docs.go fix(agent): search bound knowledge bases before answering, and pass suggested-question origins (#3400) 2026-09-18 17:00:47 +08:00
embed-secure-mode.md fix(embed): enforce host origin allowlists on framed pages 2026-09-14 18:03:57 +08:00
embed-subdomain.md fix(embed): enforce host origin allowlists on framed pages 2026-09-14 18:03:57 +08:00
mcp-tool-directory.md feat(mcp)!: persist tool catalogs and add guided configuration (#3118) 2026-09-09 13:34:56 +08:00
migration-troubleshooting.md feat(system-info): surface DB migration errors with troubleshooting links 2026-05-14 16:34:50 +08:00
paradedb-upgrade.md fix(docker): upgrade ParadeDB for CPUs without AVX2 2026-09-17 17:17:04 +08:00
sandbox-cluster.md feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
sandbox-desktop.md feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
sandbox-docker-backend.md feat(sandbox): add a graphical desktop to session sandboxes (#3245) 2026-09-14 20:37:37 +08:00
sandbox-protocol.md feat(sandbox): run sandboxed execs as root by default (#3067) 2026-09-07 13:03:35 +08:00
swagger.json fix(agent): search bound knowledge bases before answering, and pass suggested-question origins (#3400) 2026-09-18 17:00:47 +08:00
swagger.yaml fix(agent): search bound knowledge bases before answering, and pass suggested-question origins (#3400) 2026-09-18 17:00:47 +08:00
swagger_contract_test.go feat(faq): filter entries by enabled status (#3157) 2026-09-10 14:42:59 +08:00
worker-pool-governance.md feat(worker): replace aggregate asynq concurrency with per-pool governance 2026-07-13 15:51:06 +08:00
使用其他向量数据库.md feat(retriever): configure Tencent VectorDB replicas via env 2026-06-22 20:21:25 +08:00
共享空间说明.md refactor(terminology): rename user-facing tenant labels to workspace 2026-07-14 16:14:43 +08:00
开发指南.md fix: update dev script checks and Air docs 2026-07-01 11:52:42 +08:00
开启知识图谱功能.md feat: Update VLM configuration in knowledge base and API documentation 2025-11-20 20:08:24 +08:00
快速开发模式说明.md docs: update Air installation command from cosmtrek/air to air-verse/air 2026-02-04 19:27:44 +08:00
数据源导入开发文档.md feat(datasource): add DingTalk Docs integration with safe sync and localization (#2313) 2026-09-14 19:53:29 +08:00
日志配置.md refactor(logger): support LOG_FORMAT template and harden level coloring 2026-05-22 20:31:54 +08:00
添加新的网络搜索引擎.md feat(web-search): refactor web search provider 2026-03-31 20:22:34 +08:00