mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-23 10:44:21 +01:00
docs: add config example to SDK server creation
This commit is contained in:
@@ -65,6 +65,31 @@ console.log(`Server running at ${server.url}`)
|
|||||||
server.close()
|
server.close()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can also pass a configuration object to customize the server behavior:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { createOpencodeServer } from "@opencode-ai/sdk"
|
||||||
|
|
||||||
|
const server = await createOpencodeServer({
|
||||||
|
hostname: "127.0.0.1",
|
||||||
|
port: 4096,
|
||||||
|
config: {
|
||||||
|
theme: "dark",
|
||||||
|
model: "anthropic/claude-3-5-sonnet-20241022",
|
||||||
|
agent: {
|
||||||
|
general: {
|
||||||
|
temperature: 0.7,
|
||||||
|
model: "anthropic/claude-3-5-sonnet-20241022",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log(`Server running at ${server.url}`)
|
||||||
|
|
||||||
|
server.close()
|
||||||
|
```
|
||||||
|
|
||||||
#### Options
|
#### Options
|
||||||
|
|
||||||
| Option | Type | Description | Default |
|
| Option | Type | Description | Default |
|
||||||
@@ -73,6 +98,7 @@ server.close()
|
|||||||
| `port` | `number` | Server port | `4096` |
|
| `port` | `number` | Server port | `4096` |
|
||||||
| `signal` | `AbortSignal` | Abort signal for cancellation | `undefined` |
|
| `signal` | `AbortSignal` | Abort signal for cancellation | `undefined` |
|
||||||
| `timeout` | `number` | Timeout in ms for server start | `5000` |
|
| `timeout` | `number` | Timeout in ms for server start | `5000` |
|
||||||
|
| `config` | `Config` | Configuration object | `{}` |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user