Function
buildHeaders
(additionalHeaders: Record<string, string> = {})
Source from the content-addressed store, hash-verified
| 20 | |
| 21 | // 构建请求头 |
| 22 | const buildHeaders = (additionalHeaders: Record<string, string> = {}) => { |
| 23 | const headers: Record<string, string> = { |
| 24 | "Content-Type": "application/json", |
| 25 | ...additionalHeaders, |
| 26 | }; |
| 27 | |
| 28 | // 如果有 API Key,添加到请求头 |
| 29 | if (apiKey) { |
| 30 | headers["X-API-Key"] = apiKey; |
| 31 | } |
| 32 | |
| 33 | return headers; |
| 34 | }; |
| 35 | |
| 36 | // 创建 Aster Client 并添加 agent 管理方法 |
| 37 | const client = { |
Tested by
no test coverage detected