mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-08-01 16:43:37 +08:00
Merge pull request #1018 from Raphaelowo/fix(adapters)-shorten-Windows-paths-in-tool-summaries
优化Win工具显示路径
This commit is contained in:
commit
e3f5e6eb1f
@ -118,8 +118,14 @@ describe('formatToolUse', () => {
|
||||
|
||||
expect(result).toBe('🔧 Read …/project/src/index.ts')
|
||||
})
|
||||
|
||||
it('shortens Windows paths in file tool summaries', () => {
|
||||
const result = formatToolUse('Read', { file_path: 'C:\\Users\\test\\project\\src\\index.ts' })
|
||||
expect(result).toBe('🔧 Read …/project/src/index.ts')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
describe('formatPermissionRequest', () => {
|
||||
it('includes tool name, input preview, and request ID', () => {
|
||||
const result = formatPermissionRequest('Bash', { command: 'rm -rf /' }, 'abcde')
|
||||
|
||||
@ -223,7 +223,7 @@ function formatToolSummary(tool: string, inp: Record<string, unknown>): string |
|
||||
}
|
||||
|
||||
function shortPath(fp: string): string {
|
||||
const parts = fp.split('/')
|
||||
const parts = fp.replaceAll('\\', '/').split('/')
|
||||
return parts.length > 3 ? '…/' + parts.slice(-3).join('/') : fp
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user