feat: Implement compatibility strategies for responses and chat endpoints
- Added `routeCompatibility.ts` to handle response compatibility for different endpoints. - Introduced `chatEndpointStrategy.ts` to manage chat endpoint recovery and downgrading logic. - Created tests for chat formats and input file handling in `chatFormatsCore.test.ts` and `inputFile.test.ts`. - Developed `endpointCompatibility.ts` to define compatibility checks and header building for various endpoints. - Implemented protocol lifecycle management in `protocolLifecycle.ts` and corresponding tests in `protocolModel.test.ts`. - Enhanced tooltip functionality with a new `TooltipLayer` component and associated tests. - Refactored existing components to improve tooltip handling and ensure proper rendering in the application.
This commit is contained in:
+13
-35
@@ -5,7 +5,7 @@ export default withMermaid(
|
||||
defineConfig({
|
||||
lang: 'zh-CN',
|
||||
title: 'Metapi 文档',
|
||||
description: '面向普通用户的 Metapi 使用文档',
|
||||
description: 'Metapi 使用文档、FAQ 与维护协作指南',
|
||||
cleanUrls: true,
|
||||
lastUpdated: true,
|
||||
ignoreDeadLinks: true,
|
||||
@@ -14,51 +14,29 @@ export default withMermaid(
|
||||
logo: '/logos/logo-icon-512.png',
|
||||
nav: [
|
||||
{ text: '首页', link: '/' },
|
||||
{ text: '快速开始', link: '/getting-started' },
|
||||
{ text: '快速上手', link: '/getting-started' },
|
||||
{ text: '上游接入', link: '/upstream-integration' },
|
||||
{ text: '下游接入', link: '/client-integration' },
|
||||
{ text: 'FAQ / 排错', link: '/faq' },
|
||||
{ text: 'FAQ', link: '/faq' },
|
||||
{ text: '文档维护', link: '/README' },
|
||||
{ text: '项目主页', link: 'https://github.com/cita-777/metapi' },
|
||||
],
|
||||
sidebar: [
|
||||
{
|
||||
text: '开始使用',
|
||||
text: '开始',
|
||||
items: [
|
||||
{ text: '文档首页', link: '/' },
|
||||
{ text: '快速开始', link: '/getting-started' },
|
||||
{ text: '快速上手', link: '/getting-started' },
|
||||
{ text: '部署指南', link: '/deployment' },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: '上游接入',
|
||||
text: '使用与运维',
|
||||
items: [
|
||||
{ text: '上游接入总览', link: '/upstream-integration' },
|
||||
{ text: 'New API', link: '/upstream/new-api' },
|
||||
{ text: 'Sub2API', link: '/upstream/sub2api' },
|
||||
{ text: 'AnyRouter', link: '/upstream/anyrouter' },
|
||||
{ text: 'One API', link: '/upstream/one-api' },
|
||||
{ text: 'OneHub', link: '/upstream/onehub' },
|
||||
{ text: 'DoneHub', link: '/upstream/donehub' },
|
||||
{ text: 'Veloera', link: '/upstream/veloera' },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: '下游接入',
|
||||
items: [
|
||||
{ text: '下游接入', link: '/client-integration' },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: 'FAQ 与排错',
|
||||
items: [
|
||||
{ text: 'FAQ / 排错', link: '/faq' },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: '高级与自托管',
|
||||
items: [
|
||||
{ text: '自托管部署与反向代理', link: '/deployment' },
|
||||
{ text: '运行配置与部署级配置', link: '/configuration' },
|
||||
{ text: '运维与维护', link: '/operations' },
|
||||
{ text: '上游接入', link: '/upstream-integration' },
|
||||
{ text: '配置说明', link: '/configuration' },
|
||||
{ text: '客户端接入', link: '/client-integration' },
|
||||
{ text: '运维手册', link: '/operations' },
|
||||
{ text: '常见问题 FAQ', link: '/faq' },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@ npm run docs:build
|
||||
|------|--------|------------|
|
||||
| 对外第一印象、产品定位、核心入口 | [文档首页](/) | 需要调整公开落地页信息架构、首页 CTA 或首屏导航时 |
|
||||
| 新用户部署与首条请求 | [快速上手](./getting-started.md) | 新安装流程、默认端口、首次调用步骤变化时 |
|
||||
| 上游平台选择与接法 | [上游接入](./upstream-integration.md) | 平台支持范围、默认连接分段、自动识别规则变化时 |
|
||||
| 生产部署与回滚 | [部署指南](./deployment.md) | Docker Compose、反向代理、升级回滚策略变更时 |
|
||||
| 环境变量、参数和配置项 | [配置说明](./configuration.md) | 新增配置、默认值变化、兼容行为变化时 |
|
||||
| 客户端与工具接入 | [客户端接入](./client-integration.md) | Open WebUI、Cherry Studio、Cursor 等接入方式变化时 |
|
||||
|
||||
@@ -118,9 +118,11 @@ npm run dev
|
||||
进入 **站点管理**,添加你使用的上游中转站:
|
||||
|
||||
- 填写站点名称(自己想怎么取就怎么取)和 URL
|
||||
- 选择平台类型(New API / One API / OneHub / DoneHub / Veloera / AnyRouter / Sub2API),通常可自动检测
|
||||
- 选择平台类型(`new-api` / `one-api` / `one-hub` / `done-hub` / `veloera` / `anyrouter` / `sub2api` / `openai` / `claude` / `gemini` / `cliproxyapi`),通常可自动检测
|
||||
- 填写站点的管理员 API Key(可选,部分功能需要)
|
||||
|
||||
如果你不确定该选哪个平台,先看 [上游接入](./upstream-integration.md)。
|
||||
|
||||

|
||||
|
||||
### 步骤 2:添加账号
|
||||
@@ -206,6 +208,7 @@ curl -sS http://127.0.0.1:4312/v1/models \
|
||||
|
||||
## 下一步
|
||||
|
||||
- [上游接入](./upstream-integration.md) — 当前代码支持哪些上游、默认该走哪个连接分段
|
||||
- [部署指南](./deployment.md) — 反向代理、HTTPS、升级策略
|
||||
- [配置说明](./configuration.md) — 详细环境变量与路由参数
|
||||
- [客户端接入](./client-integration.md) — 对接 Open WebUI、Cherry Studio 等
|
||||
|
||||
+7
-6
@@ -12,23 +12,23 @@ hero:
|
||||
- theme: brand
|
||||
text: 10 分钟快速上手
|
||||
link: /getting-started
|
||||
- theme: alt
|
||||
text: 上游接入
|
||||
link: /upstream-integration
|
||||
- theme: alt
|
||||
text: 常见问题 FAQ
|
||||
link: /faq
|
||||
- theme: alt
|
||||
text: 文档维护与贡献
|
||||
link: /README
|
||||
|
||||
features:
|
||||
- title: 快速上手
|
||||
details: 从部署到第一条请求,按步骤完成最小可用环境搭建。
|
||||
link: /getting-started
|
||||
- title: 上游接入
|
||||
details: 按当前代码支持的平台类型,快速判断该选什么平台、先走哪个连接分段。
|
||||
link: /upstream-integration
|
||||
- title: 问题排查
|
||||
details: 汇总高频报错、根因定位和标准修复路径,降低重复沟通成本。
|
||||
link: /faq
|
||||
- title: 运维与配置
|
||||
details: 覆盖部署、配置、监控、备份、升级回滚等生产场景。
|
||||
link: /operations
|
||||
---
|
||||
|
||||
## 项目架构
|
||||
@@ -289,6 +289,7 @@ onBeforeUnmount(() => {
|
||||
## 从这里开始
|
||||
|
||||
- 初次部署或首次接入:从 [快速上手](/getting-started) 开始,先跑通最小可用链路。
|
||||
- 不确定上游平台该怎么选:先看 [上游接入](/upstream-integration),再决定走 `账号管理` 还是 `API Key管理`。
|
||||
- 准备上线或升级回滚:查看 [部署指南](/deployment) 与 [运维手册](/operations)。
|
||||
- 需要补齐环境变量或路由参数:直接查 [配置说明](/configuration)。
|
||||
- 正在处理客户端或第三方工具接入:优先看 [客户端接入](/client-integration)。
|
||||
|
||||
Reference in New Issue
Block a user