1 | |
2 | * edit copilot config |
3 | * |
4 | */ |
5 | export async function main( |
6 | workspace: string, |
7 | body: { |
8 | openai_resource_path?: string; |
9 | code_completion_enabled: boolean; |
10 | [k: string]: unknown; |
11 | } |
12 | ) { |
13 | const url = new URL( |
14 | `${BASE_URL}/api/w/${workspace}/workspaces/edit_copilot_config` |
15 | ); |
16 |
|
17 | const response = await fetch(url, { |
18 | method: "POST", |
19 | headers: { |
20 | "Content-Type": "application/json", |
21 | Authorization: "Bearer " + WM_TOKEN, |
22 | }, |
23 | body: JSON.stringify(body), |
24 | }); |
25 | if (!response.ok) { |
26 | const text = await response.text(); |
27 | throw new Error(`${response.status} ${text}`); |
28 | } |
29 | return await response.text(); |
30 | } |
31 |
|