🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix: gray images, text wrapping, and format layout in screenshot export (#19395)
Coooolfan15f55396e476
diff --git a/package.json b/package.jsonindex 0da821cdb58..e1f88e28a1c 100644--- a/package.json+++ b/package.json@@ -351,7 +351,7 @@"@xterm/addon-webgl": "^0.18.0","@xterm/xterm": "^5.5.0","@xyflow/react": "^12.11.5",- "@zumer/snapdom": "^1.9.14",+ "@zumer/snapdom": "^2.24.10","ahooks": "^3.9.7","antd": "6.3.5","antd-style": "4.1.0",diff --git a/src/features/Conversation/ChatItem/components/Title.tsx b/src/features/Conversation/ChatItem/components/Title.tsxindex 0ccfd67822a..a61760a35c6 100644--- a/src/features/Conversation/ChatItem/components/Title.tsx+++ b/src/features/Conversation/ChatItem/components/Title.tsx@@ -22,7 +22,7 @@ const Title = memo<TitleProps>(({ showTitle, time, avatar, titleAddon }) => {return (<>{showTitle && (- <Text fontSize={14} weight={500}>+ <Text fontSize={14} style={{ whiteSpace: 'nowrap' }} weight={500}>{title}</Text>)}diff --git a/src/features/Conversation/Messages/Assistant/components/ThreadExecutionSummary.tsx b/src/features/Conversation/Messages/Assistant/components/ThreadExecutionSummary.tsxindex c25746a4328..7e1570d3a93 100644--- a/src/features/Conversation/Messages/Assistant/components/ThreadExecutionSummary.tsx+++ b/src/features/Conversation/Messages/Assistant/components/ThreadExecutionSummary.tsx@@ -39,7 +39,16 @@ const ThreadExecutionSummary = memo<ThreadExecutionSummaryProps>(({ messageId })return (<AccordionindicatorPlacement="inline"- items={[{ key: 'execution-record', title: <Text type={'secondary'}>{label}</Text> }]}+ items={[+ {+ key: 'execution-record',+ title: (+ <Text style={{ whiteSpace: 'nowrap' }} type={'secondary'}>+ {label}+ </Text>+ ),+ },+ ]}styles={{ trigger: { paddingBlock: 4, paddingInline: 4 } }}value={[]}variant={'borderless'}diff --git a/src/features/Conversation/Messages/AssistantGroup/components/ProcessFold.tsx b/src/features/Conversation/Messages/AssistantGroup/components/ProcessFold.tsxindex ac6ebb6612d..80c4496a80d 100644--- a/src/features/Conversation/Messages/AssistantGroup/components/ProcessFold.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/components/ProcessFold.tsx@@ -12,6 +12,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({title: css`min-width: 0;color: ${cssVar.colorTextTertiary};+ white-space: nowrap;transition: color 150ms ${cssVar.motionEaseOut};&:hover {diff --git a/src/features/Conversation/Messages/components/Extras/Usage/index.tsx b/src/features/Conversation/Messages/components/Extras/Usage/index.tsxindex b119ed2bf8c..1f4ac432903 100644--- a/src/features/Conversation/Messages/components/Extras/Usage/index.tsx+++ b/src/features/Conversation/Messages/components/Extras/Usage/index.tsx@@ -27,6 +27,7 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({container: css`font-size: 12px;color: ${cssVar.colorTextQuaternary};+ white-space: nowrap;`,}));diff --git a/src/features/Conversation/components/ShareMessageModal/ShareImage/index.tsx b/src/features/Conversation/components/ShareMessageModal/ShareImage/index.tsxindex cd33f2e58e1..d5dd16dafa0 100644--- a/src/features/Conversation/components/ShareMessageModal/ShareImage/index.tsx+++ b/src/features/Conversation/components/ShareMessageModal/ShareImage/index.tsx@@ -77,7 +77,7 @@ const ShareImage = memo<{ message: UIChatMessage; mobile?: boolean; uniqueId?: s{children: <Tabs items={imageTypeOptions} />,label: t('shareModal.imageType'),- layout: 'horizontal',+ layout: 'vertical',minWidth: undefined,name: 'imageType',valuePropName: 'activeKey',diff --git a/src/features/ShareModal/ShareImage/index.tsx b/src/features/ShareModal/ShareImage/index.tsxindex fe0cb3b3ad8..618d7cac214 100644--- a/src/features/ShareModal/ShareImage/index.tsx+++ b/src/features/ShareModal/ShareImage/index.tsx@@ -71,7 +71,7 @@ const ShareImage = memo<{ mobile?: boolean }>(() => {{children: <Tabs items={imageTypeOptions} />,label: t('shareModal.imageType'),- layout: 'horizontal',+ layout: 'vertical',minWidth: undefined,name: 'imageType',valuePropName: 'activeKey',diff --git a/src/hooks/useScreenshot.test.ts b/src/hooks/useScreenshot.test.tsnew file mode 100644index 00000000000..0d6a7b7c0d4--- /dev/null+++ b/src/hooks/useScreenshot.test.ts@@ -0,0 +1,56 @@+// @vitest-environment happy-dom+import { beforeEach, describe, expect, it, vi } from 'vitest';++import { getImageUrl, ImageType } from './useScreenshot';++const { snapdom, toBlob, toRaw } = vi.hoisted(() => {+ const toBlob = vi.fn();+ const snapdom = Object.assign(vi.fn(), { toBlob });++ return { snapdom, toBlob, toRaw: vi.fn() };+});++vi.mock('@zumer/snapdom', () => ({ snapdom }));++vi.mock('@lobechat/business-const', () => ({+ BRANDING_NAME: 'LobeHub',+}));++describe('getImageUrl', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ });++ it('captures raster images without placeholders or a third-party proxy', async () => {+ toBlob.mockResolvedValue(new Blob(['x'], { type: 'image/png' }));+ document.body.innerHTML = '<div id="preview"><img src="data:image/png;base64,aaa"/></div>';++ await getImageUrl({ imageType: ImageType.PNG, width: 640 });++ const options = toBlob.mock.calls[0][1];+ expect(options).toMatchObject({+ placeholders: false,+ scale: 2,+ type: 'png',+ width: 640,+ });+ expect(options).not.toHaveProperty('useProxy');+ });++ it('captures SVG images without placeholders or a third-party proxy', async () => {+ toRaw.mockReturnValue('<svg xmlns="http://www.w3.org/2000/svg"/>');+ snapdom.mockResolvedValue({ toRaw });+ document.body.innerHTML = '<div id="preview"><img src="data:image/png;base64,aaa"/></div>';++ await getImageUrl({ imageType: ImageType.SVG, width: 640 });++ const options = snapdom.mock.calls[0][1];+ expect(options).toMatchObject({+ placeholders: false,+ scale: 2,+ width: 640,+ });+ expect(options).not.toHaveProperty('useProxy');+ expect(toRaw).toHaveBeenCalledOnce();+ });+});diff --git a/src/hooks/useScreenshot.ts b/src/hooks/useScreenshot.tsindex 22f1f13c407..1ab1c54e7fd 100644--- a/src/hooks/useScreenshot.ts+++ b/src/hooks/useScreenshot.ts@@ -37,6 +37,7 @@ export const getImageUrl = async ({}const baseOptions = {+ placeholders: false,scale: 2,width,};@@ -52,8 +53,8 @@ export const getImageUrl = async ({// For raster formats, use toBlob directly with type optionconst blobType = (imageType === ImageType.JPG ? 'jpg' : imageType) as 'png' | 'jpg' | 'webp';const blobResult = await snapdom.toBlob(width ? copy : dom, {+ ...baseOptions,type: blobType,- useProxy: 'https://proxy.corsfix.com/?',});if (!blobResult) {