@rei-standard/amsg-server 2.5.2 → 2.6.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -62,9 +62,17 @@ const rei = await createReiServer({
62
62
 
63
63
  当 `messageType` 为 `prompted` / `auto`,或 `instant` 使用 AI 配置时:
64
64
 
65
- - `apiUrl` 必须是完整聊天端点(例如:`https://api.openai.com/v1/chat/completions`)。
66
- - SDK 会自动做最小规范化:去首尾空白、去路径尾部多余 `/`。
67
- - SDK **不会**自动补全 `/v1`、`/chat/completions` 等路径。
65
+ - `apiUrl` 是聊天端点 URL(例如:`https://api.openai.com/v1/chat/completions`),必须能 `new URL(...)` 解析。
66
+ - SDK 对 OpenAI 风格路径做**幂等**补全(去首尾空白、去尾部多余 `/` 后):
67
+
68
+ | 输入 | 输出 |
69
+ |---|---|
70
+ | `https://api.openai.com`(裸域名) | `https://api.openai.com/v1/chat/completions` |
71
+ | `https://api.openai.com/v1`(版本段结尾) | `https://api.openai.com/v1/chat/completions`(不重复加 `/v1`) |
72
+ | `https://api.openai.com/v1/chat/completions` | 原样返回 |
73
+ | `https://api.anthropic.com/v1/messages`(其他自定义路径) | 原样返回,不猜 |
74
+
75
+ - 规则幂等,传完整 URL 不会被改坏;代理路径很特殊时直接传完整 `…/chat/completions` 绕开补全。
68
76
  - `maxTokens` 为可选字段:传了就映射为 `max_tokens`;不传则不指定(由上游模型默认策略决定)。
69
77
 
70
78
  如果上游返回 `405 Method Not Allowed`,通常表示 `apiUrl` 指向了基础域名而非聊天端点,请优先检查配置值。