feat(web): 分类展示公开 API 文档
将通用开放接口与兼容接口分层展示,补充完整接口目录、分类路由、搜索能力和接入约定。\n\n验证:pnpm nx run web:test;pnpm nx run web:build
This commit is contained in:
+10
-4
@@ -12,7 +12,7 @@ export interface AppRouteState {
|
||||
export const defaultRouteState: AppRouteState = {
|
||||
activePage: 'home',
|
||||
adminSection: 'overview',
|
||||
apiDocSection: 'chat',
|
||||
apiDocSection: 'openApiOverview',
|
||||
playgroundMode: 'chat',
|
||||
workspaceSection: 'overview',
|
||||
workspaceTaskQuery: defaultWorkspaceTaskQuery(),
|
||||
@@ -43,6 +43,12 @@ const adminPaths: Record<AdminSection, string> = {
|
||||
};
|
||||
|
||||
const docsPaths: Record<ApiDocSection, string> = {
|
||||
openApiOverview: '/docs/open-api',
|
||||
compatApiOverview: '/docs/compatible-api',
|
||||
compatGemini: '/docs/compatible-api/gemini',
|
||||
compatKling: '/docs/compatible-api/kling',
|
||||
compatVolces: '/docs/compatible-api/volces',
|
||||
compatServerMain: '/docs/compatible-api/server-main',
|
||||
guideBaseUrl: '/docs/auth',
|
||||
guideWebhook: '/docs/webhook',
|
||||
guideErrors: '/docs/errors',
|
||||
@@ -129,7 +135,7 @@ export function pathForAdminSection(section: AdminSection) {
|
||||
}
|
||||
|
||||
export function pathForApiDocSection(section: ApiDocSection) {
|
||||
return docsPaths[section] ?? docsPaths.chat;
|
||||
return docsPaths[section] ?? docsPaths.openApiOverview;
|
||||
}
|
||||
|
||||
export function pathForPlaygroundMode(mode: PlaygroundMode) {
|
||||
@@ -148,7 +154,7 @@ function parseAdminSection(path: string): AdminSection {
|
||||
}
|
||||
|
||||
function parseDocSection(path: string): ApiDocSection {
|
||||
if (path === '/docs') return 'chat';
|
||||
if (path === '/docs') return 'openApiOverview';
|
||||
if (path === '/docs/playground') return 'guideTesting';
|
||||
if (path === '/docs/api/chat') return 'chat';
|
||||
if (path === '/docs/api/responses') return 'responses';
|
||||
@@ -157,7 +163,7 @@ function parseDocSection(path: string): ApiDocSection {
|
||||
if (path === '/docs/api/media') return 'imageGeneration';
|
||||
if (path === '/docs/api/videos') return 'videoGeneration';
|
||||
if (path === '/docs/api/tasks') return 'taskRetrieve';
|
||||
return docsSections[path] ?? 'chat';
|
||||
return docsSections[path] ?? 'openApiOverview';
|
||||
}
|
||||
|
||||
function parsePlaygroundMode(path: string): PlaygroundMode {
|
||||
|
||||
Reference in New Issue
Block a user