Skip to content

Commit

Permalink
perf: 添加缺省SYSTEM_INIT_MESSAGE ,防止部分模型缺少prompt导致报错
Browse files Browse the repository at this point in the history
  • Loading branch information
TBXark committed Nov 14, 2024
1 parent 463cf14 commit 226c08d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/buildinfo.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/apps/vercel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"types": "./dist/index.d.ts",
"scripts": {
"build": "pnpm vite build",
"clean": "rm -rf dist",
"sync": "tsx src/sync.ts"
"clean": "rm -rf dist"
},
"dependencies": {
"@chatgpt-telegram-workers/core": "workspace:*",
Expand Down
3 changes: 3 additions & 0 deletions packages/lib/core/src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ class Environment extends EnvironmentConfig {
this.migrateOldEnv(source);
this.USER_CONFIG.DEFINE_KEYS = [];
this.I18N = loadI18n(this.LANGUAGE.toLowerCase());
if (!this.USER_CONFIG.SYSTEM_INIT_MESSAGE) {
this.USER_CONFIG.SYSTEM_INIT_MESSAGE = this.I18N?.env?.system_init_message || 'You are a helpful assistant';
}
}

private mergeCommands(prefix: string, descriptionPrefix: string, scopePrefix: string, source: any, target: Record<string, CommandConfig>) {
Expand Down
4 changes: 2 additions & 2 deletions packages/lib/core/src/config/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const BUILD_TIMESTAMP = 1731581746;
export const BUILD_VERSION = '54bfa9a';
export const BUILD_TIMESTAMP = 1731589675;
export const BUILD_VERSION = '463cf14';
10 changes: 7 additions & 3 deletions scripts/vercel-sync-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ async function main() {
VERCEL_BIN = './node_modules/.bin/vercel',
} = process.env;

const envs = execSync(`${VERCEL_BIN} env ls ${VERCEL_ENV}`, {
encoding: 'utf-8',
}).trim().split('\n').map(l => l.trim()).slice(1).map(l => l.split(/\s+/)[0]).map(l => l.replace(/[^\x20-\x7E]/g, '').replace(/\[\d+m/g, ''));
const envs = execSync(`${VERCEL_BIN} env ls ${VERCEL_ENV}`, { encoding: 'utf-8' })
.trim()
.split('\n')
.map(l => l.trim())
.slice(1)
.map(l => l.split(/\s+/)[0])
.map(l => l.replace(/[^\x20-\x7E]/g, '').replace(/\[\d+m/g, ''));
const usedKeys = new Set<string>();
usedKeys.add('UPSTASH_REDIS_REST_URL');
usedKeys.add('UPSTASH_REDIS_REST_TOKEN');
Expand Down

0 comments on commit 226c08d

Please sign in to comment.