feat: 全部类型问题解决

This commit is contained in:
claude-code-best
2026-04-11 10:24:00 +08:00
parent 7088fe3c8b
commit 6a70056910
135 changed files with 671 additions and 503 deletions

View File

@@ -46,14 +46,14 @@ export function analyzeContext(messages: Message[]): TokenStats {
messages.forEach(msg => {
if (msg.type === 'attachment') {
const type = msg.attachment.type || 'unknown'
const type = msg.attachment!.type || 'unknown'
stats.attachments.set(type, (stats.attachments.get(type) || 0) + 1)
}
})
const normalizedMessages = normalizeMessagesForAPI(messages)
normalizedMessages.forEach(msg => {
const { content } = msg.message
const { content } = msg.message!
// Not sure if this path is still used, but adding as a fallback
if (typeof content === 'string') {
@@ -67,7 +67,7 @@ export function analyzeContext(messages: Message[]): TokenStats {
tokens
}
} else {
content.forEach(block =>
content!.forEach(block =>
processBlock(
block,
msg,