mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 13:55:50 +00:00
feat: 添加对 langfuse 监控的支持 (#242)
* docs: 更新类型检查的 CLAUDE.md * feat: 添加模型 1M 上下文切换 * chore: remove prefetchOfficialMcpUrls call on startup * docs: 添加 git commit 规范 * feat: 第一次接入 langfuse * fix: 修复 generation 的计时的错误 * feat: 添加多 agent 的监控 * feat: 添加 /poor 省流模式,toggle 关闭 extract_memories 和 prompt_suggestion Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: 修复 lock 文件 * chore: 更新类型依赖 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
11
src/commands/poor/index.ts
Normal file
11
src/commands/poor/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { Command } from '../../commands.js'
|
||||
|
||||
const poor = {
|
||||
type: 'local',
|
||||
name: 'poor',
|
||||
description: 'Toggle poor mode — disable extract_memories and prompt_suggestion to save tokens',
|
||||
supportsNonInteractive: false,
|
||||
load: () => import('./poor.js'),
|
||||
} satisfies Command
|
||||
|
||||
export default poor
|
||||
28
src/commands/poor/poor.ts
Normal file
28
src/commands/poor/poor.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { LocalCommandCall } from '../../types/command.js'
|
||||
import { isPoorModeActive, setPoorMode } from './poorMode.js'
|
||||
|
||||
export const call: LocalCommandCall = async (_, context) => {
|
||||
const currentlyActive = isPoorModeActive()
|
||||
const newState = !currentlyActive
|
||||
setPoorMode(newState)
|
||||
|
||||
if (newState) {
|
||||
// Disable prompt suggestion in AppState
|
||||
context.setAppState(prev => ({
|
||||
...prev,
|
||||
promptSuggestionEnabled: false,
|
||||
}))
|
||||
} else {
|
||||
// Re-enable prompt suggestion
|
||||
context.setAppState(prev => ({
|
||||
...prev,
|
||||
promptSuggestionEnabled: true,
|
||||
}))
|
||||
}
|
||||
|
||||
const status = newState ? 'ON' : 'OFF'
|
||||
const details = newState
|
||||
? 'extract_memories and prompt_suggestion are disabled'
|
||||
: 'extract_memories and prompt_suggestion are restored'
|
||||
return { type: 'text', value: `Poor mode ${status} — ${details}` }
|
||||
}
|
||||
14
src/commands/poor/poorMode.ts
Normal file
14
src/commands/poor/poorMode.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Poor mode state — when active, skips extract_memories and prompt_suggestion
|
||||
* to reduce token consumption.
|
||||
*/
|
||||
|
||||
let poorModeActive = false
|
||||
|
||||
export function isPoorModeActive(): boolean {
|
||||
return poorModeActive
|
||||
}
|
||||
|
||||
export function setPoorMode(active: boolean): void {
|
||||
poorModeActive = active
|
||||
}
|
||||
Reference in New Issue
Block a user