fix(v13): V13 审计 6 项修复 — TrajectoryRecorder注册 + industryStore接入 + 知识搜索 + webhook标注 + structured UI + persistent注释
FIX-01: TrajectoryRecorderMiddleware 注册到 create_middleware_chain() (@650优先级) FIX-02: industryStore 接入 ButlerPanel 行业专长展示 + 自动拉取 FIX-03: 桌面端知识库搜索 saas-knowledge mixin + VikingPanel SaaS KB UI FIX-04: webhook 迁移标注 deprecated + 添加 down migration 注释 FIX-05: Admin Knowledge 添加结构化数据 Tab (CRUD + 行浏览) FIX-06: PersistentMemoryStore 精化 dead_code 标注 (完整迁移留后续) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -70,6 +70,7 @@ export type {
|
||||
IndustryInfo,
|
||||
IndustryFullConfig,
|
||||
AccountIndustryItem,
|
||||
KnowledgeSearchResult,
|
||||
} from './saas-types';
|
||||
|
||||
export { SaaSApiError } from './saas-errors';
|
||||
@@ -114,6 +115,7 @@ import { installPromptMethods } from './saas-prompt';
|
||||
import { installTelemetryMethods } from './saas-telemetry';
|
||||
import { installBillingMethods } from './saas-billing';
|
||||
import { installIndustryMethods } from './saas-industry';
|
||||
import { installKnowledgeMethods } from './saas-knowledge';
|
||||
export type { UsageIncrementResult } from './saas-billing';
|
||||
|
||||
// Re-export billing types for convenience
|
||||
@@ -448,6 +450,7 @@ installPromptMethods(SaaSClient);
|
||||
installTelemetryMethods(SaaSClient);
|
||||
installBillingMethods(SaaSClient);
|
||||
installIndustryMethods(SaaSClient);
|
||||
installKnowledgeMethods(SaaSClient);
|
||||
export { installBillingMethods };
|
||||
|
||||
// === API Method Type Declarations ===
|
||||
@@ -511,6 +514,9 @@ export interface SaaSClient {
|
||||
getIndustryFullConfig(industryId: string): Promise<import('./saas-types').IndustryFullConfig>;
|
||||
getMyIndustries(): Promise<import('./saas-types').AccountIndustryItem[]>;
|
||||
getAccountIndustries(accountId: string): Promise<import('./saas-types').AccountIndustryItem[]>;
|
||||
|
||||
// --- Knowledge (saas-knowledge.ts) ---
|
||||
searchKnowledge(query: string, opts?: { category_id?: string; limit?: number }): Promise<import('./saas-types').KnowledgeSearchResult[]>;
|
||||
}
|
||||
|
||||
// === Singleton ===
|
||||
|
||||
25
desktop/src/lib/saas-knowledge.ts
Normal file
25
desktop/src/lib/saas-knowledge.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* SaaS Knowledge Methods — Mixin
|
||||
*
|
||||
* Installs knowledge-search methods onto SaaSClient.prototype.
|
||||
*/
|
||||
|
||||
import type { KnowledgeSearchResult } from './saas-types';
|
||||
|
||||
export function installKnowledgeMethods(ClientClass: { prototype: any }): void {
|
||||
const proto = ClientClass.prototype;
|
||||
|
||||
/**
|
||||
* Search the SaaS knowledge base.
|
||||
*/
|
||||
proto.searchKnowledge = async function (
|
||||
this: { request<T>(method: string, path: string, body?: unknown): Promise<T> },
|
||||
query: string,
|
||||
opts?: { category_id?: string; limit?: number },
|
||||
): Promise<KnowledgeSearchResult[]> {
|
||||
return this.request('POST', '/api/v1/knowledge/search', {
|
||||
query,
|
||||
...opts,
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -272,6 +272,17 @@ export interface AccountIndustryItem {
|
||||
industry_icon: string;
|
||||
}
|
||||
|
||||
/** Knowledge search result from POST /api/v1/knowledge/search */
|
||||
export interface KnowledgeSearchResult {
|
||||
chunk_id: string;
|
||||
item_id: string;
|
||||
item_title: string;
|
||||
category_name: string;
|
||||
content: string;
|
||||
score: number;
|
||||
keywords: string[];
|
||||
}
|
||||
|
||||
/** Provider info from GET /api/v1/providers */
|
||||
export interface ProviderInfo {
|
||||
id: string;
|
||||
|
||||
Reference in New Issue
Block a user