mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-13 03:13:41 +08:00
Add GET /api/v1/channels/webchat/wiki/pages mirroring /skills, so downstream integrators can build a [[slug]] picker UI that points the LLM at specific wiki pages. The picker token format is the universal Obsidian/Wikipedia wikilink convention; the LLM consumes [[slug]] via the existing wiki_read_page(slug=...) tool, so no agent-runtime changes are needed. - AgentBindingResolver.getBoundKbIds(agentId): three-state mirror of getBoundSkillIds. null = no rows (fall through to workspace-wide KBs), Set.of() = explicitly scoped to zero KBs, non-empty = explicit scope. - WebChatController.listWikiPages: API Key + visitorToken auth chain, agentId workspace anti-escalation, visibility excludes pageType= synthesis (LLM intermediate artifacts), 100-page cap forces keyword filter, response carries only display-level metadata. - WebChatWikiPageView DTO: kbId/kbName/slug/title/summary/pageType; content/embedding/sourceRawIds deliberately stay admin-console-only. - WikiTool.wiki_read_page @Tool description: document the [[slug]] convention so the LLM treats each token as a wiki-page reference. - WebChatWikiPageListTest: 8 cases covering happy path, keyword filter, synthesis exclusion, anti-escalation, auth failures, cap behavior, and the no-binding → workspace-wide fallback. Closes #381.
38 lines
1.3 KiB
Java
38 lines
1.3 KiB
Java
package vip.mate.llm.routing;
|
|
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
|
|
/**
|
|
* Read access to an agent's skill / provider / wiki-kb bindings, as needed by
|
|
* {@link ProviderRouter} for capability-aware routing and by webchat
|
|
* endpoints that need to enumerate an agent's visible catalog.
|
|
*
|
|
* <p>Declared in the {@code llm} layer so the routing code depends only on
|
|
* this abstraction. The {@code agent} layer supplies the implementation,
|
|
* keeping the dependency direction {@code agent → llm}.
|
|
*/
|
|
public interface AgentBindingResolver {
|
|
|
|
/**
|
|
* Skill ids bound to the agent, or {@code null} when the agent has no
|
|
* explicit bindings (meaning "use the global default").
|
|
*/
|
|
Set<Long> getBoundSkillIds(Long agentId);
|
|
|
|
/**
|
|
* Provider ids the agent prefers, in priority order; empty when none.
|
|
*/
|
|
List<String> getPreferredProviderIds(Long agentId);
|
|
|
|
/**
|
|
* Wiki knowledge-base ids bound to the agent, or {@code null} when the
|
|
* agent has no explicit KB scope (meaning "workspace-wide — every KB
|
|
* in the agent's workspace is visible"). Mirrors the three-state
|
|
* contract of {@link #getBoundSkillIds}: {@code null} = inherit
|
|
* default, {@code Set.of()} = explicitly scoped to nothing, non-empty
|
|
* = the explicit allowlist.
|
|
*/
|
|
Set<Long> getBoundKbIds(Long agentId);
|
|
}
|