Skip to content

Commit

Permalink
perf: Optimize message storage.
Browse files Browse the repository at this point in the history
MAX_HISTORY_LENGTH is adjusted to user config, when <=0, history will not be read/stored.
Empty text messages are no longer processed.
Optimize the format of error messages during conversations.
  • Loading branch information
adolphnov committed Dec 17, 2024
1 parent 2390601 commit 8614dca
Show file tree
Hide file tree
Showing 14 changed files with 236 additions and 260 deletions.
3 changes: 1 addition & 2 deletions doc/en/CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ OPENAI_API_BASE,GOOGLE_API_BASE,MISTRAL_API_BASE,COHERE_API_BASE,ANTHROPIC_API_B
| KEY | Name | Default | Description |
|--------------------|---------------------------------------|---------|---------------------------------------------------------------|
| AUTO_TRIM_HISTORY | Automatic trimming of message history | `true` | Automatically trim messages to avoid the 4096 character limit |
| MAX_HISTORY_LENGTH | Maximum length of message history | `20` | Maximum number of message history entries to keep |
|Maximum token length |Maximum token length for message history |
| MAX_HISTORY_LENGTH | Maximum length of message history | `12` | Maximum number of message history entries to keep |

### Feature configuration

Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,47 +43,47 @@
"@ai-sdk/anthropic": "^1.0.5",
"@ai-sdk/azure": "^1.0.10",
"@ai-sdk/cohere": "^1.0.5",
"@ai-sdk/google": "^1.0.9",
"@ai-sdk/google-vertex": "^2.0.7",
"@ai-sdk/google": "^1.0.10",
"@ai-sdk/google-vertex": "^2.0.8",
"@ai-sdk/mistral": "^1.0.5",
"@ai-sdk/openai": "^1.0.8",
"@ai-sdk/provider": "^1.0.2",
"@ai-sdk/xai": "^1.0.6",
"@ffmpeg.wasm/core-st": "^0.13.2",
"@ffmpeg.wasm/main": "^0.13.1",
"ai": "^4.0.14",
"ai": "^4.0.19",
"cf-worker-adapter": "^1.4.0",
"node-cron": "^3.0.3"
},
"devDependencies": {
"@ai-sdk/anthropic": "^1.0.5",
"@ai-sdk/azure": "^1.0.10",
"@ai-sdk/cohere": "^1.0.5",
"@ai-sdk/google": "^1.0.9",
"@ai-sdk/google-vertex": "^2.0.7",
"@ai-sdk/google": "^1.0.10",
"@ai-sdk/google-vertex": "^2.0.8",
"@ai-sdk/mistral": "^1.0.5",
"@ai-sdk/openai": "^1.0.8",
"@antfu/eslint-config": "^3.11.2",
"@cloudflare/workers-types": "^4.20241205.0",
"@rollup/plugin-node-resolve": "^15.3.0",
"@antfu/eslint-config": "^3.12.0",
"@cloudflare/workers-types": "^4.20241216.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"@types/node": "^22.10.2",
"@types/node-cron": "^3.0.11",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"@types/ws": "^8.5.13",
"@vercel/node": "^3.2.29",
"ai": "^4.0.14",
"eslint": "^9.16.0",
"@vercel/node": "^5.0.0",
"ai": "^4.0.19",
"eslint": "^9.17.0",
"eslint-plugin-format": "^0.1.3",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-node-externals": "^7.1.3",
"rollup-plugin-node-externals": "^8.0.0",
"telegram-bot-api-types": "^8.1.0",
"toml": "^3.0.0",
"tsx": "^4.19.2",
"typescript": "^5.7.2",
"vite": "^6.0.3",
"vite-plugin-checker": "^0.8.0",
"vite-plugin-dts": "^4.3.0",
"wrangler": "^3.95.0"
"wrangler": "^3.96.0"
}
}
Loading

0 comments on commit 8614dca

Please sign in to comment.