## GitHub 同步说明
| 项 | 内容 |
|:---|:---|
| 仓库 | https://github.com/fnvtk/cunkebao_v3 |
| 分支 | develop |
| 方向 | 本地 → GitHub(单向 push) |
| 是否拉取远程 | 否(未 fetch / pull / merge) |
| 是否改本地文件 | 否(仅 git add/commit,未编辑任何源文件正文) |
| 基准 commit | 0643e78a |
| 变更规模 | 709 files, +26436 / -3407 lines |
## 目录变更统计
| 目录 | 文件数 | 说明 |
|:---|---:|:---|
| 开发文档/ | 404 | 四端进行中/已完成需求、接口文档、官网需求、部署脚本 |
| Server/ | 95 | 后端 API、迁移脚本、触客宝/超管/存客宝服务 |
| Cunkebao/ | 85 | 移动端 H5、设备绑定、客服、转号审批等 |
| Touchkebao/ | 68 | PC 工作台、AI 获客、算力中心、Glass UI |
| SuperAdmin/ | 33 | 超管项目中心、算力计费、内容库 |
| 官网/ | 19 | 新增存客宝官网静态页(index/pricing/solutions 等) |
| .cursor/ | 3 | Cursor 规则与 Skill |
| .obsidian/ | 2 | Obsidian 工作区配置 |
## 重点新增/更新(本地为准)
- 官网/: 完整静态站点(index、pricing、manual、solutions、api)
- 开发文档/1、需求/修改/*_进行中_20260530.md(存客宝/触客宝/AI数智员工)
- 开发文档/1、需求/官网需求.md
- 开发文档/5、接口/开发进度_接口文档.md 等接口文档迭代
- Touchkebao Glass UI 与 P0 收尾、通道获客算力
- SuperAdmin 算力计费规则、项目工作台
## 刻意未上传(本地保留)
- node_modules/
- .DS_Store、.smart-env/
- .开发文档_nested_git_backup/(旧嵌套 git 备份)
- **/__pycache__/
## 验收
GitHub 浏览: https://github.com/fnvtk/cunkebao_v3/tree/develop
Co-authored-by: Cursor <cursoragent@cursor.com>
99 lines
2.6 KiB
TypeScript
99 lines
2.6 KiB
TypeScript
import { apiRequest, ApiResponse } from "./api-utils";
|
||
|
||
/** AI 中心 · 全平台大模型接口配置(§二 2.3~2.6) */
|
||
|
||
export interface AiTier {
|
||
code: string;
|
||
name: string;
|
||
desc: string;
|
||
}
|
||
|
||
export interface AiProvider {
|
||
id: string;
|
||
providerCode: string;
|
||
displayName: string;
|
||
apiBaseUrl: string;
|
||
apiKeyMasked?: string;
|
||
hasKey?: boolean;
|
||
defaultModel: string;
|
||
tier: string;
|
||
weight: number;
|
||
priority: number;
|
||
timeoutMs: number;
|
||
status: number;
|
||
_fromEnv?: boolean;
|
||
}
|
||
|
||
export interface AiSceneRule {
|
||
tier: string;
|
||
strategy: string;
|
||
}
|
||
|
||
export interface AiRouting {
|
||
strategy: string;
|
||
sceneMap: Record<string, AiSceneRule>;
|
||
}
|
||
|
||
export interface AiCenterConfig {
|
||
providers: AiProvider[];
|
||
tiers: AiTier[];
|
||
routing: AiRouting;
|
||
strategies: string[];
|
||
providerCodes: string[];
|
||
}
|
||
|
||
export interface AiTestResult {
|
||
ok: boolean;
|
||
ms: number;
|
||
model: string;
|
||
sample: string;
|
||
error?: string;
|
||
}
|
||
|
||
export const STRATEGY_LABEL: Record<string, string> = {
|
||
primary: "主备",
|
||
round_robin: "轮询",
|
||
weighted: "加权轮询",
|
||
scene_map: "按场景映射",
|
||
};
|
||
|
||
export function getAiCenterConfig(): Promise<ApiResponse<AiCenterConfig>> {
|
||
return apiRequest("/ai-center/config");
|
||
}
|
||
|
||
export function getAiProviders(): Promise<ApiResponse<{ list: AiProvider[] }>> {
|
||
return apiRequest("/ai-center/providers");
|
||
}
|
||
|
||
export function createAiProvider(payload: Partial<AiProvider> & { apiKey?: string }): Promise<ApiResponse<AiProvider>> {
|
||
return apiRequest("/ai-center/providers", "POST", payload);
|
||
}
|
||
|
||
export function updateAiProvider(id: string, payload: Partial<AiProvider> & { apiKey?: string }): Promise<ApiResponse<AiProvider>> {
|
||
return apiRequest(`/ai-center/providers/${encodeURIComponent(id)}`, "PUT", payload);
|
||
}
|
||
|
||
export function deleteAiProvider(id: string): Promise<ApiResponse<{ deleted: boolean }>> {
|
||
return apiRequest(`/ai-center/providers/${encodeURIComponent(id)}`, "DELETE");
|
||
}
|
||
|
||
export function getAiTiers(): Promise<ApiResponse<{ list: AiTier[] }>> {
|
||
return apiRequest("/ai-center/tiers");
|
||
}
|
||
|
||
export function saveAiTiers(tiers: AiTier[]): Promise<ApiResponse<{ list: AiTier[] }>> {
|
||
return apiRequest("/ai-center/tiers", "PUT", { tiers });
|
||
}
|
||
|
||
export function getAiRouting(): Promise<ApiResponse<AiRouting>> {
|
||
return apiRequest("/ai-center/routing");
|
||
}
|
||
|
||
export function saveAiRouting(routing: AiRouting): Promise<ApiResponse<AiRouting>> {
|
||
return apiRequest("/ai-center/routing", "PUT", routing);
|
||
}
|
||
|
||
export function testAiProvider(providerId: string, prompt?: string): Promise<ApiResponse<AiTestResult>> {
|
||
return apiRequest("/ai-center/test", "POST", { providerId, prompt });
|
||
}
|