refactor(agent): remove deprecated agent options. (#585)
* refactor(agent): remove deprecated agent options. * fix: overwrite old template if user has not modified it. * fix: also remove debounce options.r0.4
parent
7818f640e9
commit
5cd32eb7c0
|
|
@ -53,9 +53,10 @@ export const defaultAgentConfig: AgentConfig = {
|
||||||
mode: "adaptive",
|
mode: "adaptive",
|
||||||
interval: 250, // ms
|
interval: 250, // ms
|
||||||
},
|
},
|
||||||
|
// Deprecated: There is a timeout of 3s on the server side since v0.3.0.
|
||||||
timeout: {
|
timeout: {
|
||||||
auto: 5000, // 5s
|
auto: 4000, // 4s
|
||||||
manually: 30000, // 30s
|
manually: 4000, // 4s
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
logs: {
|
logs: {
|
||||||
|
|
@ -66,7 +67,7 @@ export const defaultAgentConfig: AgentConfig = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const configTomlTemplate = `## Tabby agent configuration file
|
const oldConfigTomlTemplate = `## Tabby agent configuration file
|
||||||
|
|
||||||
## You can uncomment any block to enable settings.
|
## You can uncomment any block to enable settings.
|
||||||
## Configurations in this file has lower priority than in IDE settings.
|
## Configurations in this file has lower priority than in IDE settings.
|
||||||
|
|
@ -109,6 +110,32 @@ const configTomlTemplate = `## Tabby agent configuration file
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const configTomlTemplate = `## Tabby agent configuration file
|
||||||
|
|
||||||
|
## You can uncomment any block to enable settings.
|
||||||
|
## Configurations in this file has lower priority than in IDE settings.
|
||||||
|
|
||||||
|
## Server
|
||||||
|
## You can set the server endpoint here.
|
||||||
|
# [server]
|
||||||
|
# endpoint = "http://localhost:8080" # http or https URL
|
||||||
|
|
||||||
|
## You can add custom request headers, e.g. for authentication.
|
||||||
|
# [server.requestHeaders]
|
||||||
|
# Authorization = "Bearer eyJhbGciOiJ..........."
|
||||||
|
|
||||||
|
## Logs
|
||||||
|
## You can set the log level here. The log file is located at ~/.tabby-client/agent/logs/.
|
||||||
|
# [logs]
|
||||||
|
# level = "silent" # or "error" or "debug"
|
||||||
|
|
||||||
|
## Anonymous usage tracking
|
||||||
|
## You can disable anonymous usage tracking here.
|
||||||
|
# [anonymousUsageTracking]
|
||||||
|
# disable = false # set to true to disable
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
||||||
export const userAgentConfig = isBrowser
|
export const userAgentConfig = isBrowser
|
||||||
? null
|
? null
|
||||||
: (() => {
|
: (() => {
|
||||||
|
|
@ -135,6 +162,12 @@ export const userAgentConfig = isBrowser
|
||||||
async load() {
|
async load() {
|
||||||
try {
|
try {
|
||||||
const fileContent = await fs.readFile(this.filepath, "utf8");
|
const fileContent = await fs.readFile(this.filepath, "utf8");
|
||||||
|
// If the config file is the old template, and user has not modified it,
|
||||||
|
// Overwrite it with the new template.
|
||||||
|
if (fileContent.trim() === oldConfigTomlTemplate.trim()) {
|
||||||
|
await this.createTemplate();
|
||||||
|
return await this.load();
|
||||||
|
}
|
||||||
this.data = toml.parse(fileContent);
|
this.data = toml.parse(fileContent);
|
||||||
super.emit("updated", this.data);
|
super.emit("updated", this.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue