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

@@ -42,7 +42,19 @@
| `/v1/messages/count_tokens` | 透传 |
| `/v1/*` | 透传 |
### 2.2 接口能力矩阵
### 2.2 detectInterfaceType
```
Anthropic.detectInterfaceType(nativePath):
if nativePath == "/v1/messages": return CHAT
if nativePath == "/v1/models": return MODELS
if nativePath matches "^/v1/models/[^/]+$": return MODEL_INFO
return PASSTHROUGH
```
**说明**`detectInterfaceType` 由 Anthropic Adapter 实现,根据 Anthropic 协议的 URL 路径约定识别接口类型。
### 2.3 接口能力矩阵
```
Anthropic.supportsInterface(type):
@@ -54,7 +66,7 @@ Anthropic.supportsInterface(type):
default: return false
```
### 2.3 URL 映射表
### 2.4 URL 映射表
```
Anthropic.buildUrl(nativePath, interfaceType):
@@ -771,6 +783,7 @@ Anthropic.encodeError(error):
| 章节 | 检查项 |
|------|--------|
| §2 | [x] `detectInterfaceType(nativePath)` 已实现,所有已知路径已覆盖 |
| §2 | [x] 所有 InterfaceType 的 `supportsInterface` 返回值已确定 |
| §2 | [x] 所有 InterfaceType 的 `buildUrl` 映射已确定 |
| §3 | [x] `buildHeaders(provider)` 已实现adapter_config 契约已文档化 |