Spaces:
Paused
Paused
icebear icebear0828 commited on
fix: disable desktop context injection by default (#95) (#97)
Browse files* fix: disable desktop context injection by default (#95)
The proxy was injecting a ~1500 token desktop context system prompt
into every request, inflating prompt_tokens from ~17 to ~1587 for
a simple message. Add `model.inject_desktop_context` config option
(default false) to skip injection unless explicitly enabled.
* docs: update CHANGELOG for #95
* chore: revert unrelated default.yaml changes
---------
Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com>
- CHANGELOG.md +4 -0
- config/default.yaml +1 -0
- src/config.ts +1 -0
- src/translation/shared-utils.ts +1 -0
CHANGELOG.md
CHANGED
|
@@ -6,6 +6,10 @@
|
|
| 6 |
|
| 7 |
## [Unreleased]
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
### Added
|
| 10 |
|
| 11 |
- 额度自动刷新 + 分层预警:后台每 5 分钟(可配置)定时拉取所有账号的官方额度,缓存到 AccountEntry 供 Dashboard 即时读取;额度达到阈值(默认 80%/90%,可自定义)时显示 warning/critical 横幅;额度耗尽的账号自动标记为 rate_limited 跳过分配,到期自动恢复 (#92)
|
|
|
|
| 6 |
|
| 7 |
## [Unreleased]
|
| 8 |
|
| 9 |
+
### Fixed
|
| 10 |
+
|
| 11 |
+
- 默认关闭 desktop context 注入:之前每次请求注入 ~1500 token 的 Codex Desktop 系统提示,导致 prompt_tokens 虚高;新增 `model.inject_desktop_context` 配置项(默认 `false`),需要时可手动开启 (#95)
|
| 12 |
+
|
| 13 |
### Added
|
| 14 |
|
| 15 |
- 额度自动刷新 + 分层预警:后台每 5 分钟(可配置)定时拉取所有账号的官方额度,缓存到 AccountEntry 供 Dashboard 即时读取;额度达到阈值(默认 80%/90%,可自定义)时显示 warning/critical 横幅;额度耗尽的账号自动标记为 rate_limited 跳过分配,到期自动恢复 (#92)
|
config/default.yaml
CHANGED
|
@@ -12,6 +12,7 @@ model:
|
|
| 12 |
default: gpt-5.2-codex
|
| 13 |
default_reasoning_effort: medium
|
| 14 |
default_service_tier: null
|
|
|
|
| 15 |
suppress_desktop_directives: true
|
| 16 |
auth:
|
| 17 |
jwt_token: null
|
|
|
|
| 12 |
default: gpt-5.2-codex
|
| 13 |
default_reasoning_effort: medium
|
| 14 |
default_service_tier: null
|
| 15 |
+
inject_desktop_context: false
|
| 16 |
suppress_desktop_directives: true
|
| 17 |
auth:
|
| 18 |
jwt_token: null
|
src/config.ts
CHANGED
|
@@ -23,6 +23,7 @@ const ConfigSchema = z.object({
|
|
| 23 |
default: z.string().default("gpt-5.2-codex"),
|
| 24 |
default_reasoning_effort: z.string().default("medium"),
|
| 25 |
default_service_tier: z.string().nullable().default(null),
|
|
|
|
| 26 |
suppress_desktop_directives: z.boolean().default(true),
|
| 27 |
}),
|
| 28 |
auth: z.object({
|
|
|
|
| 23 |
default: z.string().default("gpt-5.2-codex"),
|
| 24 |
default_reasoning_effort: z.string().default("medium"),
|
| 25 |
default_service_tier: z.string().nullable().default(null),
|
| 26 |
+
inject_desktop_context: z.boolean().default(false),
|
| 27 |
suppress_desktop_directives: z.boolean().default(true),
|
| 28 |
}),
|
| 29 |
auth: z.object({
|
src/translation/shared-utils.ts
CHANGED
|
@@ -43,6 +43,7 @@ const SUPPRESS_PROMPT =
|
|
| 43 |
* to override desktop-specific behaviors.
|
| 44 |
*/
|
| 45 |
export function buildInstructions(userInstructions: string): string {
|
|
|
|
| 46 |
const ctx = getDesktopContext();
|
| 47 |
if (!ctx) return userInstructions;
|
| 48 |
if (getConfig().model.suppress_desktop_directives) {
|
|
|
|
| 43 |
* to override desktop-specific behaviors.
|
| 44 |
*/
|
| 45 |
export function buildInstructions(userInstructions: string): string {
|
| 46 |
+
if (!getConfig().model.inject_desktop_context) return userInstructions;
|
| 47 |
const ctx = getDesktopContext();
|
| 48 |
if (!ctx) return userInstructions;
|
| 49 |
if (getConfig().model.suppress_desktop_directives) {
|