mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
feat: 增强 auto mode 的易用性 (#312)
* feat: poor 模式降级 yolo 审阅模型 * feat: 为多模块添加 Langfuse tracing 支持 在 web search、agent creation、away summary、token estimation、 skill improvement 等模块中集成 Langfuse trace,并透传至 compact/apiQueryHook/execPromptHook 等调用链。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: 让 auto mode 记录回主 trace * fix: reopen auto mode prompt when classifier is unavailable * fix: 修复 auto mode 情况下, llm 报错导致弹窗也不打开的问题 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,9 @@ import type {
|
||||
} from '@anthropic-ai/sdk/resources/beta/messages/messages.mjs'
|
||||
import { getFeatureValue_CACHED_MAY_BE_STALE } from 'src/services/analytics/growthbook.js'
|
||||
import { queryModelWithStreaming } from 'src/services/api/claude.js'
|
||||
import { createTrace, endTrace, isLangfuseEnabled } from 'src/services/langfuse/index.js'
|
||||
import { getSessionId } from 'src/bootstrap/state.js'
|
||||
import { getAPIProvider } from 'src/utils/model/providers.js'
|
||||
import { createUserMessage } from 'src/utils/messages.js'
|
||||
import { getMainLoopModel, getSmallFastModel } from 'src/utils/model/model.js'
|
||||
import { jsonParse } from 'src/utils/slowOperations.js'
|
||||
@@ -38,6 +41,15 @@ export class ApiSearchAdapter implements WebSearchAdapter {
|
||||
const toolSchema = makeToolSchema({ allowedDomains, blockedDomains })
|
||||
|
||||
const useHaiku = getFeatureValue_CACHED_MAY_BE_STALE('tengu_plum_vx3', false)
|
||||
const model = useHaiku ? getSmallFastModel() : getMainLoopModel()
|
||||
const langfuseTrace = isLangfuseEnabled()
|
||||
? createTrace({
|
||||
sessionId: getSessionId(),
|
||||
model,
|
||||
provider: getAPIProvider(),
|
||||
name: 'web-search-tool',
|
||||
})
|
||||
: null
|
||||
|
||||
const queryStream = queryModelWithStreaming({
|
||||
messages: [userMessage],
|
||||
@@ -58,7 +70,7 @@ export class ApiSearchAdapter implements WebSearchAdapter {
|
||||
alwaysAskRules: {},
|
||||
isBypassPermissionsModeAvailable: false,
|
||||
}),
|
||||
model: useHaiku ? getSmallFastModel() : getMainLoopModel(),
|
||||
model,
|
||||
toolChoice: useHaiku ? { type: 'tool' as const, name: 'web_search' } : undefined,
|
||||
isNonInteractiveSession: false,
|
||||
hasAppendSystemPrompt: false,
|
||||
@@ -68,6 +80,7 @@ export class ApiSearchAdapter implements WebSearchAdapter {
|
||||
mcpTools: [],
|
||||
agentId: undefined,
|
||||
effortValue: undefined,
|
||||
langfuseTrace,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -148,6 +161,8 @@ export class ApiSearchAdapter implements WebSearchAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
endTrace(langfuseTrace)
|
||||
|
||||
// Extract SearchResult[] from content blocks
|
||||
return extractSearchResults(allContentBlocks)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user