-
Notifications
You must be signed in to change notification settings - Fork 170
Expand file tree
/
Copy pathconfig.ts
More file actions
59 lines (48 loc) · 1.56 KB
/
config.ts
File metadata and controls
59 lines (48 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import vscode from 'vscode';
class Config {
// Inference
get inference() {
let config = this.#config;
// Load endpoint
let endpoint = (config.get('endpoint') as string).trim();
if (endpoint.endsWith('/')) {
endpoint = endpoint.slice(0, endpoint.length - 1).trim();
}
if (endpoint === '') {
endpoint = 'http://127.0.0.1:11434';
}
let bearerToken = config.get('bearerToken') as string;
// Load general paremeters
let maxLines = config.get('maxLines') as number;
let maxTokens = config.get('maxTokens') as number;
let temperature = config.get('temperature') as number;
// Load model
let modelName = config.get('model') as string;
let delay = config.get('delay') as number;
return {
endpoint,
bearerToken,
maxLines,
maxTokens,
temperature,
modelName,
delay
};
}
// Notebook
get notebook() {
let config = vscode.workspace.getConfiguration('notebook');
let includeMarkup = config.get('includeMarkup') as boolean;
let includeCellOutputs = config.get('includeCellOutputs') as boolean;
let cellOutputLimit = config.get('cellOutputLimit') as number;
return {
includeMarkup,
includeCellOutputs,
cellOutputLimit,
};
}
get #config() {
return vscode.workspace.getConfiguration('inference');
};
}
export const config = new Config();