1
0

docs: 补充detectInterfaceType实现说明

This commit is contained in:
2026-04-19 18:09:13 +08:00
parent 4dc518a5f4
commit b14685d9a5
3 changed files with 43 additions and 7 deletions

View File

@@ -41,7 +41,21 @@
| `/v1/embeddings` | EMBEDDINGS |
| `/v1/rerank` | RERANK |
### 2.2 接口能力矩阵
### 2.2 detectInterfaceType
```
OpenAI.detectInterfaceType(nativePath):
if nativePath == "/v1/chat/completions": return CHAT
if nativePath == "/v1/models": return MODELS
if nativePath matches "^/v1/models/[^/]+$": return MODEL_INFO
if nativePath == "/v1/embeddings": return EMBEDDINGS
if nativePath == "/v1/rerank": return RERANK
return PASSTHROUGH
```
**说明**`detectInterfaceType` 由 OpenAI Adapter 实现,根据 OpenAI 协议的 URL 路径约定识别接口类型。
### 2.3 接口能力矩阵
```
OpenAI.supportsInterface(type):
@@ -55,7 +69,7 @@ OpenAI.supportsInterface(type):
default: return false
```
### 2.3 URL 映射表
### 2.4 URL 映射表
```
OpenAI.buildUrl(nativePath, interfaceType):
@@ -1141,6 +1155,7 @@ mapErrorCode(code):
| 章节 | 检查项 |
| ---- | -------------------------------------------------------------------------------------------- |
| §2 | [x] `detectInterfaceType(nativePath)` 已实现,所有已知路径已覆盖 |
| §2 | [x] 所有 InterfaceType 的 `supportsInterface` 返回值已确定 |
| §2 | [x] 所有 InterfaceType 的 `buildUrl` 映射已确定 |
| §3 | [x]`buildHeaders(provider)` 已实现adapter_config 契约已文档化 |