fix(docs): address documentation site review

This commit is contained in:
Yichen Jiang
2026-07-13 17:47:42 +08:00
parent 341b56ebc3
commit 6be219a0bc
12 changed files with 333 additions and 212 deletions
@@ -114,6 +114,8 @@ interface GenerateOptions {
maxTokens?: number
/** 温度 */
temperature?: number
/** 取消或卸载时中止进行中的请求 */
signal?: AbortSignal
}
```
@@ -160,7 +162,10 @@ mock 适配器是学习 StreamChunk 协议的最佳起点——它用纯本地
```typescript
async *stream(options: GenerateOptions): AsyncIterable<StreamChunk> {
const response = await fetch(this.endpoint, { /* ... */ })
const response = await fetch(this.endpoint, {
// ...method、headers 和 body
signal: options.signal,
})
if (!response.ok) {
throw new Error(`API error: ${response.status}`)
}