diff --git a/dist/buildinfo.json b/dist/buildinfo.json index b094dbd7..0ecf6f03 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha":"839f57f","timestamp":1724829364} \ No newline at end of file +{"sha":"ef4e54b","timestamp":1724829578} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 02398a8b..cbdcb083 100644 --- a/dist/index.js +++ b/dist/index.js @@ -212,8 +212,8 @@ const ENV_KEY_MAPPER = { WORKERS_AI_MODEL: "WORKERS_CHAT_MODEL" }; class Environment extends EnvironmentConfig { - BUILD_TIMESTAMP = 1724829364 ; - BUILD_VERSION = "839f57f" ; + BUILD_TIMESTAMP = 1724829578 ; + BUILD_VERSION = "ef4e54b" ; I18N = loadI18n(); PLUGINS_ENV = {}; USER_CONFIG = createAgentUserConfig(); @@ -2063,7 +2063,7 @@ class SetEnvCommandHandler { console.log("Update user config: ", key, context.USER_CONFIG[key]); await ENV.DATABASE.put( context.SHARE_CONTEXT.configStoreKey, - JSON.stringify(context.USER_CONFIG) + JSON.stringify(ConfigMerger.trim(context.USER_CONFIG, ENV.LOCK_USER_CONFIG_KEYS)) ); return sender.sendPlainText("Update user config success"); } catch (e) { @@ -2097,7 +2097,7 @@ class SetEnvsCommandHandler { context.USER_CONFIG.DEFINE_KEYS = Array.from(new Set(context.USER_CONFIG.DEFINE_KEYS)); await ENV.DATABASE.put( context.SHARE_CONTEXT.configStoreKey, - JSON.stringify(context.USER_CONFIG) + JSON.stringify(ConfigMerger.trim(context.USER_CONFIG, ENV.LOCK_USER_CONFIG_KEYS)) ); return sender.sendPlainText("Update user config success"); } catch (e) { @@ -2119,7 +2119,7 @@ class DelEnvCommandHandler { context.USER_CONFIG.DEFINE_KEYS = context.USER_CONFIG.DEFINE_KEYS.filter((key) => key !== subcommand); await ENV.DATABASE.put( context.SHARE_CONTEXT.configStoreKey, - JSON.stringify(context.USER_CONFIG) + JSON.stringify(ConfigMerger.trim(context.USER_CONFIG, ENV.LOCK_USER_CONFIG_KEYS)) ); return sender.sendPlainText("Delete user config success"); } catch (e) { @@ -2199,7 +2199,7 @@ class SystemCommandHandler { context.USER_CONFIG.MISTRAL_API_KEY = "******"; context.USER_CONFIG.COHERE_API_KEY = "******"; context.USER_CONFIG.ANTHROPIC_API_KEY = "******"; - const config = context.USER_CONFIG; + const config = ConfigMerger.trim(context.USER_CONFIG, ENV.LOCK_USER_CONFIG_KEYS); msg = `
${msg}`; msg += `USER_CONFIG: ${JSON.stringify(config, null, 2)} diff --git a/dist/timestamp b/dist/timestamp index 362f97a6..2d3f5c29 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1724829364 \ No newline at end of file +1724829578 \ No newline at end of file diff --git a/src/telegram/command/system.ts b/src/telegram/command/system.ts index e735d591..464d9d53 100644 --- a/src/telegram/command/system.ts +++ b/src/telegram/command/system.ts @@ -152,7 +152,7 @@ export class SetEnvCommandHandler implements CommandHandler { console.log('Update user config: ', key, context.USER_CONFIG[key]); await ENV.DATABASE.put( context.SHARE_CONTEXT.configStoreKey, - JSON.stringify(context.USER_CONFIG), + JSON.stringify(ConfigMerger.trim(context.USER_CONFIG, ENV.LOCK_USER_CONFIG_KEYS)), ); return sender.sendPlainText('Update user config success'); } catch (e) { @@ -187,7 +187,7 @@ export class SetEnvsCommandHandler implements CommandHandler { context.USER_CONFIG.DEFINE_KEYS = Array.from(new Set(context.USER_CONFIG.DEFINE_KEYS)); await ENV.DATABASE.put( context.SHARE_CONTEXT.configStoreKey, - JSON.stringify(context.USER_CONFIG), + JSON.stringify(ConfigMerger.trim(context.USER_CONFIG, ENV.LOCK_USER_CONFIG_KEYS)), ); return sender.sendPlainText('Update user config success'); } catch (e) { @@ -210,7 +210,7 @@ export class DelEnvCommandHandler implements CommandHandler { context.USER_CONFIG.DEFINE_KEYS = context.USER_CONFIG.DEFINE_KEYS.filter(key => key !== subcommand); await ENV.DATABASE.put( context.SHARE_CONTEXT.configStoreKey, - JSON.stringify(context.USER_CONFIG), + JSON.stringify(ConfigMerger.trim(context.USER_CONFIG, ENV.LOCK_USER_CONFIG_KEYS)), ); return sender.sendPlainText('Delete user config success'); } catch (e) { @@ -292,7 +292,7 @@ export class SystemCommandHandler implements CommandHandler { context.USER_CONFIG.MISTRAL_API_KEY = '******'; context.USER_CONFIG.COHERE_API_KEY = '******'; context.USER_CONFIG.ANTHROPIC_API_KEY = '******'; - const config = context.USER_CONFIG; + const config = ConfigMerger.trim(context.USER_CONFIG, ENV.LOCK_USER_CONFIG_KEYS); msg = `\n${msg}`; msg += `USER_CONFIG: ${JSON.stringify(config, null, 2)}\n`; msg += `CHAT_CONTEXT: ${JSON.stringify(sender.context || {}, null, 2)}\n`;