✨ feat(vscode): 问 AI 输入框能粘贴、拖进图片随问题发给 Claude Code,缩略图能点开看大图,图片存进 .spx/code-qa 跟着问答删

This commit is contained in:
cruldra committed 2026-09-26 23:15:02 +08:00
1 parent d9a5c3673e
commit 36d842e18e
28 files changed
+825 -121

No files matched your search

@@ -92,4 +92,20 @@ describe('块下面的问答区', () => {
expect(text(html)).toContain('UserRole 还有哪些角色?昨天')
expect(text(html)).not.toContain('昨天 ·')
})
it('问题带的图片:历史和当前这一轮在问题下面一排缩略图,点开看大图,不能去掉;没带图片的不画这一排', () => {
const stored = ['https://file+.vscode-resource.vscode-cdn.net/work/.spx/code-qa/e1-1.png', 'https://file+.vscode-resource.vscode-cdn.net/work/.spx/code-qa/e1-2.jpg']
const html = render({ open: true, history: [{ ...HISTORY[0]!, images: stored }, HISTORY[1]!], asks: [ask({ images: ['data:image/png;base64,AAA'] })] })
const [first, second] = html.split('data-history=""').slice(1)
expect(first).toContain('<div class="cr-qa-thumbs">')
expect(first.indexOf('cr-qa-thumbs')).toBeGreaterThan(first.indexOf('cr-qa-head'))
expect(first.indexOf('cr-qa-thumbs')).toBeLessThan(first.indexOf('cr-qa-preview'))
expect(first).toContain(`<img src="${stored[0]}" alt=""/>`)
expect(first).toContain('aria-label="看第 2 张图片的大图"')
expect(second.slice(0, second.indexOf('data-current'))).not.toContain('cr-qa-thumbs')
const current = html.slice(html.indexOf('data-current'))
expect(current).toContain('<img src="data:image/png;base64,AAA" alt=""/>')
expect(html).not.toContain('cr-qa-thumb-remove')
expect(html).not.toContain('data-pending')
})
})