Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
fix: Share development completed (#473)
Gao3afa05fca904
diff --git a/project/web/.env b/project/web/.envindex 853fb6fc..6a83e283 100644--- a/project/web/.env+++ b/project/web/.env@@ -6,3 +6,10 @@ NEXT_PUBLIC_OSS_URL_PROXY="/ossProxy/"# yika OSSNEXT_PUBLIC_YIKA_OSS_HOST=https://yika-bj.oss-cn-beijing.aliyuncs.com++# s3 URL+NEXT_PUBLIC_S3_URL="https://aitoearn.s3.ap-southeast-1.amazonaws.com/"+# s3 代理+NEXT_PUBLIC_S3_PROXY="/s3Proxy/"++NEXT_PUBLIC_PROXY_URL="https://aitoearn.ai/"\ No newline at end of filediff --git a/project/web/next.config.mjs b/project/web/next.config.mjsindex c97b47c1..1d8137fb 100644--- a/project/web/next.config.mjs+++ b/project/web/next.config.mjs@@ -45,6 +45,10 @@ const nextConfig = {source: `${process.env.NEXT_PUBLIC_OSS_URL_PROXY}:path*`,destination: `${process.env.NEXT_PUBLIC_OSS_URL}/:path*`,},+ {+ source: `${process.env.NEXT_PUBLIC_S3_PROXY}:path*`,+ destination: `${process.env.NEXT_PUBLIC_S3_URL}:path*`,+ },]// 存在 NEXT_PUBLIC_PROXY_URL 则代理,本地直连 用diff --git a/project/web/package.json b/project/web/package.jsonindex 03d19e56..49acba8e 100644--- a/project/web/package.json+++ b/project/web/package.json@@ -97,7 +97,8 @@"tailwind-merge": "^3.4.0","tui-image-editor": "^3.15.3","zod": "^3.25.76",- "zustand": "^5.0.5"+ "zustand": "^5.0.5",+ "html2canvas-pro": "^1.4.3"},"devDependencies": {"@antfu/eslint-config": "^6.2.0",diff --git a/project/web/pnpm-lock.yaml b/project/web/pnpm-lock.yamlindex a7ec87da..4d9e7ddf 100644--- a/project/web/pnpm-lock.yaml+++ b/project/web/pnpm-lock.yaml@@ -137,6 +137,9 @@ importers:glob:specifier: ^11.0.3version: 11.0.3+ html2canvas-pro:+ specifier: ^1.4.3+ version: 1.6.2i18next:specifier: 24.2.3version: 24.2.3([email protected])@@ -2849,6 +2852,10 @@ packages:resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}+ resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==}+ engines: {node: '>= 0.6.0'}+resolution: {integrity: sha512-73lC1ugzwoaWCLJ1LvOgrR5xsMLTqSKIEoMHVtL9E/HNk0PXtTM76ZIm84856/SF7Nv8mPZxKoBsgpm0tR1u1Q==}hasBin: true@@ -3134,6 +3141,9 @@ packages:resolution: {integrity: sha512-fJAcud6B3rRu+KHYk+Bwf+WFL2MDCJJ1XG9x137tJQ0xYxor7XziQtuGFbWNdqrvF4Tk26O3H73nfVqXt/fW1A==}+ resolution: {integrity: sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==}+resolution: {integrity: sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==}@@ -4054,6 +4064,10 @@ packages:resolution: {integrity: sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==}+ resolution: {integrity: sha512-BhoazWMFupMDyprWRn32b35azl1mN/4r25wqX12DKXhwTVM/N70Wq1UrVrZouhxPMihi0fu15I4HvnGsZ6yX3Q==}+ engines: {node: '>=16.0.0'}+resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==}@@ -6048,6 +6062,9 @@ packages:engines: {node: '>=10'}hasBin: true+ resolution: {integrity: sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==}+resolution: {integrity: sha512-H7oLPV0P7+jgvrk+6mwwwBDmxTaxnu9HMXmloNLXwnNO0ZxZ31Orah2n8lU1eMPvsaowP2CX+USCgyovXfdOFQ==}engines: {node: '>=8'}@@ -6274,6 +6291,9 @@ packages:resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}+ resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==}+resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==}deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.@@ -9460,6 +9480,8 @@ snapshots:+ [email protected]: {}+@@ -9739,6 +9761,10 @@ snapshots:dependencies:hyphenate-style-name: 1.1.0+ dependencies:+ utrie: 1.0.2+dependencies:boolbase: 1.0.0@@ -10945,6 +10971,11 @@ snapshots:+ dependencies:+ css-line-break: 2.1.0+ text-segmentation: 1.0.3+dependencies:domelementtype: 2.3.0@@ -13421,6 +13452,10 @@ snapshots:commander: 2.20.3source-map-support: 0.5.21+ dependencies:+ utrie: 1.0.2+@@ -13666,6 +13701,10 @@ snapshots:+ dependencies:+ base64-arraybuffer: 1.0.2+optional: truediff --git a/project/web/public/sitemap-0.xml b/project/web/public/sitemap-0.xmlindex 4aff2667..42451262 100644--- a/project/web/public/sitemap-0.xml+++ b/project/web/public/sitemap-0.xml@@ -1,52 +1,52 @@<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">-<url><loc>https://aitoearn.ai/healthz</loc><lastmod>2025-12-25T08:13:21.639Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en</loc><lastmod>2025-12-25T06:58:43.312Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url>-<url><loc>https://aitoearn.ai/en/websit/terms-of-service</loc><lastmod>2025-12-20T14:27:57.199Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/websit/privacy-policy</loc><lastmod>2025-12-20T14:27:57.198Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/websit/plugin-guide</loc><lastmod>2025-12-20T14:27:57.198Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/websit/extension-privacy-policy</loc><lastmod>2025-12-20T14:27:57.196Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/websit/data-protection-agreement</loc><lastmod>2025-12-20T14:27:57.196Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/websit/data-deletion</loc><lastmod>2025-12-20T14:27:57.196Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/tasks-history</loc><lastmod>2025-12-25T06:58:43.312Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/tasks</loc><lastmod>2025-12-20T14:27:57.195Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/pricing</loc><lastmod>2025-12-20T14:27:57.195Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/pinterest</loc><lastmod>2025-12-23T03:24:46.958Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/material</loc><lastmod>2025-12-20T14:27:57.194Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/interactiveNew</loc><lastmod>2025-12-20T14:27:57.192Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/income</loc><lastmod>2025-12-25T06:58:43.311Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/hotContent</loc><lastmod>2025-12-20T14:27:57.190Z</lastmod><changefreq>daily</changefreq><priority>0.9</priority></url>-<url><loc>https://aitoearn.ai/en/dataStatistics</loc><lastmod>2025-12-20T14:27:57.187Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/data-monitoring</loc><lastmod>2025-12-23T03:24:46.864Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/cgmaterial</loc><lastmod>2025-12-20T14:27:57.184Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/auth/login</loc><lastmod>2025-12-20T14:27:57.183Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/auth/forgot-password</loc><lastmod>2025-12-20T14:27:57.183Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/aiRank</loc><lastmod>2025-12-20T14:27:57.183Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>-<url><loc>https://aitoearn.ai/en/aiRank/aiRanking</loc><lastmod>2025-12-20T14:27:57.182Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>-<url><loc>https://aitoearn.ai/en/accounts</loc><lastmod>2025-12-20T14:27:57.182Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/en/accounts/auth</loc><lastmod>2025-12-20T14:27:57.179Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN</loc><lastmod>2025-12-25T06:58:43.312Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/websit/terms-of-service</loc><lastmod>2025-12-20T14:27:57.199Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/websit/privacy-policy</loc><lastmod>2025-12-20T14:27:57.198Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/websit/plugin-guide</loc><lastmod>2025-12-20T14:27:57.198Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/websit/extension-privacy-policy</loc><lastmod>2025-12-20T14:27:57.196Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/websit/data-protection-agreement</loc><lastmod>2025-12-20T14:27:57.196Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/websit/data-deletion</loc><lastmod>2025-12-20T14:27:57.196Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/tasks-history</loc><lastmod>2025-12-25T06:58:43.312Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/tasks</loc><lastmod>2025-12-20T14:27:57.195Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/pricing</loc><lastmod>2025-12-20T14:27:57.195Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/pinterest</loc><lastmod>2025-12-23T03:24:46.958Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/material</loc><lastmod>2025-12-20T14:27:57.194Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/interactiveNew</loc><lastmod>2025-12-20T14:27:57.192Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/income</loc><lastmod>2025-12-25T06:58:43.311Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/hotContent</loc><lastmod>2025-12-20T14:27:57.190Z</lastmod><changefreq>daily</changefreq><priority>0.9</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/dataStatistics</loc><lastmod>2025-12-20T14:27:57.187Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/data-monitoring</loc><lastmod>2025-12-23T03:24:46.864Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/cgmaterial</loc><lastmod>2025-12-20T14:27:57.184Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/auth/login</loc><lastmod>2025-12-20T14:27:57.183Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/auth/forgot-password</loc><lastmod>2025-12-20T14:27:57.183Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/aiRank</loc><lastmod>2025-12-20T14:27:57.183Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/aiRank/aiRanking</loc><lastmod>2025-12-20T14:27:57.182Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/accounts</loc><lastmod>2025-12-20T14:27:57.182Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>-<url><loc>https://aitoearn.ai/zh-CN/accounts/auth</loc><lastmod>2025-12-20T14:27:57.179Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/healthz</loc><lastmod>2025-12-25T15:21:31.247Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en</loc><lastmod>2025-12-24T04:08:42.228Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url>+<url><loc>https://aitoearn.ai/en/websit/terms-of-service</loc><lastmod>2025-12-22T02:19:26.235Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/websit/privacy-policy</loc><lastmod>2025-12-22T02:19:26.234Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/websit/plugin-guide</loc><lastmod>2025-12-22T02:19:26.233Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/websit/extension-privacy-policy</loc><lastmod>2025-12-22T02:19:26.233Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/websit/data-protection-agreement</loc><lastmod>2025-12-12T06:46:42.348Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/websit/data-deletion</loc><lastmod>2025-12-22T02:19:26.232Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/tasks-history</loc><lastmod>2025-12-25T10:30:36.659Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/tasks</loc><lastmod>2025-11-18T02:51:00.256Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/pricing</loc><lastmod>2025-12-18T11:52:18.737Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/pinterest</loc><lastmod>2025-12-22T02:19:26.229Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/material</loc><lastmod>2025-11-18T02:51:00.224Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/interactiveNew</loc><lastmod>2025-12-18T11:52:18.730Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/income</loc><lastmod>2025-12-25T02:23:02.205Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/hotContent</loc><lastmod>2025-11-18T02:51:00.185Z</lastmod><changefreq>daily</changefreq><priority>0.9</priority></url>+<url><loc>https://aitoearn.ai/en/dataStatistics</loc><lastmod>2025-11-18T02:51:00.115Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/data-monitoring</loc><lastmod>2025-12-22T02:19:26.225Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/cgmaterial</loc><lastmod>2025-11-18T02:51:00.099Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/auth/login</loc><lastmod>2025-12-18T11:52:18.715Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/auth/forgot-password</loc><lastmod>2025-12-18T11:52:18.710Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/aiRank</loc><lastmod>2025-11-18T02:51:00.092Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>+<url><loc>https://aitoearn.ai/en/aiRank/aiRanking</loc><lastmod>2025-11-18T02:51:00.078Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>+<url><loc>https://aitoearn.ai/en/accounts</loc><lastmod>2025-12-19T13:34:03.419Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/en/accounts/auth</loc><lastmod>2025-11-18T02:50:59.996Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN</loc><lastmod>2025-12-24T04:08:42.228Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/websit/terms-of-service</loc><lastmod>2025-12-22T02:19:26.235Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/websit/privacy-policy</loc><lastmod>2025-12-22T02:19:26.234Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/websit/plugin-guide</loc><lastmod>2025-12-22T02:19:26.233Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/websit/extension-privacy-policy</loc><lastmod>2025-12-22T02:19:26.233Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/websit/data-protection-agreement</loc><lastmod>2025-12-12T06:46:42.348Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/websit/data-deletion</loc><lastmod>2025-12-22T02:19:26.232Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/tasks-history</loc><lastmod>2025-12-25T10:30:36.659Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/tasks</loc><lastmod>2025-11-18T02:51:00.256Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/pricing</loc><lastmod>2025-12-18T11:52:18.737Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/pinterest</loc><lastmod>2025-12-22T02:19:26.229Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/material</loc><lastmod>2025-11-18T02:51:00.224Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/interactiveNew</loc><lastmod>2025-12-18T11:52:18.730Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/income</loc><lastmod>2025-12-25T02:23:02.205Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/hotContent</loc><lastmod>2025-11-18T02:51:00.185Z</lastmod><changefreq>daily</changefreq><priority>0.9</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/dataStatistics</loc><lastmod>2025-11-18T02:51:00.115Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/data-monitoring</loc><lastmod>2025-12-22T02:19:26.225Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/cgmaterial</loc><lastmod>2025-11-18T02:51:00.099Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/auth/login</loc><lastmod>2025-12-18T11:52:18.715Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/auth/forgot-password</loc><lastmod>2025-12-18T11:52:18.710Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/aiRank</loc><lastmod>2025-11-18T02:51:00.092Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/aiRank/aiRanking</loc><lastmod>2025-11-18T02:51:00.078Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/accounts</loc><lastmod>2025-12-19T13:34:03.419Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/zh-CN/accounts/auth</loc><lastmod>2025-11-18T02:50:59.996Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url></urlset>\ No newline at end of filediff --git a/project/web/src/app/[lng]/accounts/accountCore.tsx b/project/web/src/app/[lng]/accounts/accountCore.tsxindex 5ed6390d..f4daa297 100644--- a/project/web/src/app/[lng]/accounts/accountCore.tsx+++ b/project/web/src/app/[lng]/accounts/accountCore.tsx@@ -238,8 +238,8 @@ export default function AccountPageCore({const data = {taskId: searchParams.taskId,- title: searchParams.title || '',- description: searchParams.description || '',+ title: searchParams.title ? decodeURIComponent(searchParams.title) : '',+ description: searchParams.description ? decodeURIComponent(searchParams.description) : '',tags: tags,medias: medias,}@@ -716,6 +716,7 @@ export default function AccountPageCore({return () => clearTimeout(timeoutId)}}, [aiGeneratedData, publishDialogOpen, allAccounts.length])+return (<NoSSR>diff --git a/project/web/src/app/[lng]/accounts/components/AddAccountModal/index.tsx b/project/web/src/app/[lng]/accounts/components/AddAccountModal/index.tsxindex 4f402f93..6f377728 100644--- a/project/web/src/app/[lng]/accounts/components/AddAccountModal/index.tsx+++ b/project/web/src/app/[lng]/accounts/components/AddAccountModal/index.tsx@@ -225,10 +225,45 @@ const AddAccountModal = memo(}// 处理Facebook页面选择成功- const handleFacebookPagesSuccess = () => {+ const handleFacebookPagesSuccess = async () => {setShowFacebookPagesModal(false)- onClose()- // 可以在这里添加成功提示或其他逻辑+ // Facebook页面选择成功后,刷新账号列表并触发成功回调+ await handleAuthSuccess(null, PlatType.Facebook)+ }++ // 统一处理授权成功后的逻辑+ const handleAuthSuccess = async (authResult: any, platType: PlatType) => {+ try {+ // 刷新账号列表+ await getAccountList()++ // 找到新添加的账号+ const afterAuthCount = accountGroupList.reduce((total, group) => total + group.children.length, 0)+ const currentSpace = accountGroupList.find(group => group.id === selectedSpaceId)++ if (currentSpace) {+ const newAccounts = currentSpace.children.filter(account => {+ // 这里可以根据时间戳或其他方式判断是否为新账号+ // 暂时简单判断数量变化+ return true // 需要更精确的判断逻辑+ })++ if (newAccounts.length > 0) {+ // 找到最新添加的账号+ const latestAccount = newAccounts[newAccounts.length - 1]+ // 触发成功回调+ onAddSuccess(latestAccount)+ // 显示成功提示+ toast.success(t('addAccountModal.authSuccess', { platform: AccountPlatInfoMap.get(platType)?.name || platType }))+ }+ }++ // 关闭弹窗+ onClose()+ } catch (error) {+ console.error('处理授权成功失败:', error)+ toast.error(t('addAccountModal.authSuccessFailed'))+ }}/**@@ -309,70 +344,72 @@ const AddAccountModal = memo(// 记录授权前的账号数量,用于后续识别新账号const beforeAuthCount = accountGroupList.reduce((total, group) => total + group.children.length, 0)- switch (key) {- case PlatType.KWAI:- // 快手授权前先显示提示- // 在 onOk 回调中直接执行授权,确保 window.open 在用户交互上下文中- await confirm({- title: t('addAccountModal.kwaiAuthWarning.title'),- content: t('addAccountModal.kwaiAuthWarning.content'),- okText: t('addAccountModal.kwaiAuthWarning.okText'),- cancelText: undefined, // 不显示取消按钮- onOk: () => {- // 在用户点击"我知道了"时立即执行授权,确保 window.open 在用户交互上下文中- kwaiSkip(key, selectedSpaceId).catch((error) => {- console.error('快手授权失败:', error)- })- },- })- break- case PlatType.BILIBILI:- await bilibiliSkip(key, selectedSpaceId)- break- case PlatType.YouTube:- await youtubeSkip(key, selectedSpaceId)- break- case PlatType.Twitter:- await twitterSkip(key, selectedSpaceId)- break- case PlatType.Tiktok:- await tiktokSkip(key, selectedSpaceId)- break- case PlatType.Facebook:- try {- await facebookSkip(key, selectedSpaceId)- // Facebook授权成功后显示页面选择弹窗- handleFacebookAuthSuccess()- }- catch (error) {- console.error('Facebook授权失败:', error)- }- break- case PlatType.Instagram:- await instagramSkip(key, selectedSpaceId)- break- case PlatType.Threads:- await threadsSkip(key, selectedSpaceId)- break- case PlatType.WxGzh:- await wxGzhSkip(key, selectedSpaceId)- break- case PlatType.Pinterest:- await pinterestSkip(key, selectedSpaceId)- break- case PlatType.LinkedIn:- await linkedinSkip(key, selectedSpaceId)- break- }+ let authResult: any = null- // 授权完成后刷新账号列表- setTimeout(async () => {- try {- await getAccountList()+ try {+ switch (key) {+ case PlatType.KWAI:+ // 快手授权前先显示提示+ // 在 onOk 回调中直接执行授权,确保 window.open 在用户交互上下文中+ await confirm({+ title: t('addAccountModal.kwaiAuthWarning.title'),+ content: t('addAccountModal.kwaiAuthWarning.content'),+ okText: t('addAccountModal.kwaiAuthWarning.okText'),+ cancelText: undefined, // 不显示取消按钮+ onOk: async () => {+ // 在用户点击"我知道了"时立即执行授权,确保 window.open 在用户交互上下文中+ try {+ authResult = await kwaiSkip(key, selectedSpaceId)+ } catch (error) {+ console.error('快手授权失败:', error)+ throw error+ }+ },+ })+ break+ case PlatType.BILIBILI:+ authResult = await bilibiliSkip(key, selectedSpaceId)+ break+ case PlatType.YouTube:+ authResult = await youtubeSkip(key, selectedSpaceId)+ break+ case PlatType.Twitter:+ authResult = await twitterSkip(key, selectedSpaceId)+ break+ case PlatType.Tiktok:+ authResult = await tiktokSkip(key, selectedSpaceId)+ break+ case PlatType.Facebook:+ authResult = await facebookSkip(key, selectedSpaceId)+ // Facebook授权成功后显示页面选择弹窗(特殊处理,不刷新账号列表)+ handleFacebookAuthSuccess()+ break+ case PlatType.Instagram:+ authResult = await instagramSkip(key, selectedSpaceId)+ break+ case PlatType.Threads:+ authResult = await threadsSkip(key, selectedSpaceId)+ break+ case PlatType.WxGzh:+ authResult = await wxGzhSkip(key, selectedSpaceId)+ break+ case PlatType.Pinterest:+ authResult = await pinterestSkip(key, selectedSpaceId)+ break+ case PlatType.LinkedIn:+ authResult = await linkedinSkip(key, selectedSpaceId)+ break}- catch (error) {++ // 统一处理授权成功后的逻辑(除了Facebook这种特殊情况)+ if (authResult && key !== PlatType.Facebook) {+ await handleAuthSuccess(authResult, key)}- }, 2000) // 等待3秒让授权完成+ } catch (error) {+ console.error(`${key} 授权失败:`, error)+ // 可以在这里添加失败提示+ }+}return (diff --git a/project/web/src/app/[lng]/accounts/plat/BilibiliLogin.ts b/project/web/src/app/[lng]/accounts/plat/BilibiliLogin.tsindex fc280998..4749ef5a 100644--- a/project/web/src/app/[lng]/accounts/plat/BilibiliLogin.ts+++ b/project/web/src/app/[lng]/accounts/plat/BilibiliLogin.ts@@ -21,7 +21,7 @@ export async function bilibiliSkip(platType: PlatType, spaceId?: string) {const url = res.data.urlwindow.open(`${url}`)- await bilibiliLogin(res.data.taskId)+ return await bilibiliLogin(res.data.taskId)}export function bilibiliLogin(taskId: any): Promise<any> {@@ -37,10 +37,7 @@ export function bilibiliLogin(taskId: any): Promise<any> {const authRess: any = await apiCheckBilibiliAuth(taskId)const authRes = authRessif (authRes?.code === 0 && authRes?.data.status == 1) {- // message.success('授权成功');- // useAccountStore- const accountStore = useAccountStore.getState()- await accountStore.getAccountList()+ // 授权成功,返回结果,交由调用方处理resolve(authRes)return true}diff --git a/project/web/src/app/[lng]/accounts/plat/FacebookLogin.ts b/project/web/src/app/[lng]/accounts/plat/FacebookLogin.tsindex 3b5bfe35..ab46b828 100644--- a/project/web/src/app/[lng]/accounts/plat/FacebookLogin.ts+++ b/project/web/src/app/[lng]/accounts/plat/FacebookLogin.ts@@ -25,7 +25,7 @@ export async function facebookSkip(platType: PlatType, spaceId?: string) {const url = res.data.urlwindow.open(`${url}`)- const facebookLoginRes = await facebookLogin(res.data.taskId)+ return await facebookLogin(res.data.taskId)}export function facebookLogin(taskId: any): Promise<any> {diff --git a/project/web/src/app/[lng]/accounts/plat/InstagramLogin.ts b/project/web/src/app/[lng]/accounts/plat/InstagramLogin.tsindex d417a767..b37efe07 100644--- a/project/web/src/app/[lng]/accounts/plat/InstagramLogin.ts+++ b/project/web/src/app/[lng]/accounts/plat/InstagramLogin.ts@@ -22,7 +22,7 @@ export async function instagramSkip(platType: PlatType, spaceId?: string) {const url = res.data.urlwindow.open(`${url}`)- const instagramLoginRes = await instagramLogin(res.data.taskId)+ return await instagramLogin(res.data.taskId)}export function instagramLogin(taskId: any): Promise<any> {@@ -38,10 +38,7 @@ export function instagramLogin(taskId: any): Promise<any> {const authRess: any = await checkMetaAuthApi(taskId)const authRes = authRessif (authRes?.code === 0 && authRes?.data.status == 1) {- // message.success('授权成功');- // useAccountStore- const accountStore = useAccountStore.getState()- await accountStore.getAccountList()+ // 授权成功,返回结果,交由调用方处理resolve(authRes)return true}diff --git a/project/web/src/app/[lng]/accounts/plat/LinkedinLogin.ts b/project/web/src/app/[lng]/accounts/plat/LinkedinLogin.tsindex e68fbe06..bdb9343d 100644--- a/project/web/src/app/[lng]/accounts/plat/LinkedinLogin.ts+++ b/project/web/src/app/[lng]/accounts/plat/LinkedinLogin.ts@@ -21,7 +21,7 @@ export async function linkedinSkip(platType: PlatType, spaceId?: string) {const url = res.data.urlwindow.open(`${url}`)- await linkedinLogin(res.data.taskId)+ return await linkedinLogin(res.data.taskId)}/**@@ -40,8 +40,7 @@ export function linkedinLogin(taskId: any): Promise<any> {const authRess: any = await checkMetaAuthApi(taskId)const authRes = authRessif (authRes?.code === 0 && authRes?.data.status == 1) {- const accountStore = useAccountStore.getState()- await accountStore.getAccountList()+ // 授权成功,返回结果,交由调用方处理resolve(authRes)return true}diff --git a/project/web/src/app/[lng]/accounts/plat/PinterestLogin.ts b/project/web/src/app/[lng]/accounts/plat/PinterestLogin.tsindex e52989bd..c662da73 100644--- a/project/web/src/app/[lng]/accounts/plat/PinterestLogin.ts+++ b/project/web/src/app/[lng]/accounts/plat/PinterestLogin.ts@@ -22,7 +22,7 @@ export async function pinterestSkip(platType: PlatType, spaceId?: string) {const url = res.data.uriwindow.open(`${url}`)- const pinterestLoginRes = await pinterestLogin(res.data.taskId)+ return await pinterestLogin(res.data.taskId)}export function pinterestLogin(taskId: any): Promise<any> {@@ -38,10 +38,7 @@ export function pinterestLogin(taskId: any): Promise<any> {const authRess: any = await checkPinterestAuthApi(taskId)const authRes = authRessif (authRes?.code === 0 && authRes?.data.status == 1) {- // message.success('授权成功');- // useAccountStore- const accountStore = useAccountStore.getState()- await accountStore.getAccountList()+ // 授权成功,返回结果,交由调用方处理resolve(authRes)return true}diff --git a/project/web/src/app/[lng]/accounts/plat/ThreadsLogin.ts b/project/web/src/app/[lng]/accounts/plat/ThreadsLogin.tsindex fa16cc3d..47d00d20 100644--- a/project/web/src/app/[lng]/accounts/plat/ThreadsLogin.ts+++ b/project/web/src/app/[lng]/accounts/plat/ThreadsLogin.ts@@ -23,7 +23,7 @@ export async function threadsSkip(platType: PlatType, spaceId?: string) {const url = res.data.urlwindow.open(`${url}`)- const threadsLoginRes = await threadsLogin(res.data.taskId)+ return await threadsLogin(res.data.taskId)}export function threadsLogin(taskId: any): Promise<any> {@@ -39,10 +39,7 @@ export function threadsLogin(taskId: any): Promise<any> {const authRess: any = await checkMetaAuthApi(taskId)const authRes = authRessif (authRes?.code === 0 && authRes?.data.status == 1) {- // message.success('授权成功');- // useAccountStore- const accountStore = useAccountStore.getState()- await accountStore.getAccountList()+ // 授权成功,返回结果,交由调用方处理resolve(authRes)return true}diff --git a/project/web/src/app/[lng]/accounts/plat/TiktokLogin.ts b/project/web/src/app/[lng]/accounts/plat/TiktokLogin.tsindex f348bdc4..553b3326 100644--- a/project/web/src/app/[lng]/accounts/plat/TiktokLogin.ts+++ b/project/web/src/app/[lng]/accounts/plat/TiktokLogin.ts@@ -22,7 +22,7 @@ export async function tiktokSkip(platType: PlatType, spaceId?: string) {const url = res.data.urlwindow.open(`${url}`)- const tiktokLoginRes = await tiktokLogin(res.data.taskId)+ return await tiktokLogin(res.data.taskId)}export function tiktokLogin(taskId: any): Promise<any> {@@ -38,10 +38,7 @@ export function tiktokLogin(taskId: any): Promise<any> {const authRess: any = await checkTiktokAuthApi(taskId)const authRes = authRessif (authRes?.code === 0 && authRes?.data.status == 1) {- // message.success('授权成功');- // useAccountStore- const accountStore = useAccountStore.getState()- await accountStore.getAccountList()+ // 授权成功,返回结果,交由调用方处理resolve(authRes)return true}diff --git a/project/web/src/app/[lng]/accounts/plat/TwtterLogin.ts b/project/web/src/app/[lng]/accounts/plat/TwtterLogin.tsindex 8d7bfe10..64f031d3 100644--- a/project/web/src/app/[lng]/accounts/plat/TwtterLogin.ts+++ b/project/web/src/app/[lng]/accounts/plat/TwtterLogin.ts@@ -22,7 +22,7 @@ export async function twitterSkip(platType: PlatType, spaceId?: string) {const url = res.data.urlwindow.open(`${url}`)- const twitterLoginRes = await twitterLogin(res.data.taskId)+ return await twitterLogin(res.data.taskId)}export function twitterLogin(taskId: any): Promise<any> {@@ -38,8 +38,7 @@ export function twitterLogin(taskId: any): Promise<any> {const authRess: any = await apiCheckTwitterAuth(taskId)const authRes = authRessif (authRes?.code === 0 && authRes?.data.status == 1) {- const accountStore = useAccountStore.getState()- await accountStore.getAccountList()+ // 授权成功,返回结果,交由调用方处理resolve(authRes)return true}diff --git a/project/web/src/app/[lng]/accounts/plat/WxGzh.ts b/project/web/src/app/[lng]/accounts/plat/WxGzh.tsindex 420c5ac7..a5c9473b 100644--- a/project/web/src/app/[lng]/accounts/plat/WxGzh.ts+++ b/project/web/src/app/[lng]/accounts/plat/WxGzh.ts@@ -22,7 +22,7 @@ export async function wxGzhSkip(platType: PlatType, spaceId?: string) {const url = res.data.urlwindow.open(`${url}`)- const wxGzhLoginRes = await wxGzhLogin(res.data.id)+ return await wxGzhLogin(res.data.id)}export function wxGzhLogin(taskId: any): Promise<any> {@@ -38,10 +38,7 @@ export function wxGzhLogin(taskId: any): Promise<any> {const authRess: any = await checkWxGzAuthApi(taskId)const authRes = authRessif (authRes?.code === 0 && authRes?.data.status == 1) {- // message.success('授权成功');- // useAccountStore- const accountStore = useAccountStore.getState()- await accountStore.getAccountList()+ // 授权成功,返回结果,交由调用方处理resolve(authRes)return true}diff --git a/project/web/src/app/[lng]/accounts/plat/YoutubeLogin.ts b/project/web/src/app/[lng]/accounts/plat/YoutubeLogin.tsindex bdaf4c8d..0bea6f53 100644--- a/project/web/src/app/[lng]/accounts/plat/YoutubeLogin.ts+++ b/project/web/src/app/[lng]/accounts/plat/YoutubeLogin.ts@@ -22,7 +22,7 @@ export async function youtubeSkip(platType: PlatType, spaceId?: string) {const url = res.data.urlwindow.open(`${url}`)- const youtubeLoginRes = await youtubeLogin(res.data.taskId)+ return await youtubeLogin(res.data.taskId)}export function youtubeLogin(taskId: any): Promise<any> {@@ -38,10 +38,7 @@ export function youtubeLogin(taskId: any): Promise<any> {const authRess: any = await apiCheckYoutubeAuth(taskId)const authRes = authRessif (authRes?.code === 0 && authRes?.data.status == 1) {- // message.success('授权成功');- // useAccountStore- const accountStore = useAccountStore.getState()- await accountStore.getAccountList()+ // 授权成功,返回结果,交由调用方处理resolve(authRes)return true}diff --git a/project/web/src/app/[lng]/accounts/plat/kwaiLogin.ts b/project/web/src/app/[lng]/accounts/plat/kwaiLogin.tsindex ee00560e..ff63cffe 100644--- a/project/web/src/app/[lng]/accounts/plat/kwaiLogin.ts+++ b/project/web/src/app/[lng]/accounts/plat/kwaiLogin.ts@@ -4,35 +4,69 @@ import { useAccountStore } from '@/store/account'import { useUserStore } from '@/store/user'import { sleep } from '@/utils'-export async function kwaiSkip(platType: PlatType, spaceId?: string) {- const res = await createKwaiAuth('pc', spaceId)- if (res?.code == 1) {- useUserStore.getState().logout()- return- }- if (!res?.data)- return- window.open(res?.data.url)-- let queryCount = 0- const maxQueryCount = 30 // 最大轮询次数-- while (queryCount < maxQueryCount) {- const autoStatusRes = await getKwaiAuthStatus(res.data.taskId)-- if (!autoStatusRes?.data)- break- if (autoStatusRes.data.status === 1) {- useAccountStore.getState().getAccountList()- break- }+export async function kwaiSkip(platType: PlatType, spaceId?: string): Promise<any> {+ return new Promise(async (resolve, reject) => {+ try {+ const res = await createKwaiAuth('pc', spaceId)+ if (res?.code == 1) {+ useUserStore.getState().logout()+ reject(new Error('login required'))+ return+ }+ if (!res?.data) {+ reject(new Error('no data'))+ return+ }++ window.open(res?.data.url)++ let queryCount = 0+ const maxQueryCount = 30 // 最大轮询次数++ const checkAuthStatus = async () => {+ try {+ queryCount+++ const autoStatusRes = await getKwaiAuthStatus(res.data.taskId)++ if (!autoStatusRes?.data) {+ reject(new Error('no status data'))+ return true+ }- queryCount++- await sleep(1000)- }+ if (autoStatusRes.data.status === 1) {+ // 授权成功,返回结果,交由调用方处理+ resolve(autoStatusRes)+ return true+ }- // 如果达到最大轮询次数仍未成功,记录日志- if (queryCount >= maxQueryCount) {- console.log('快手授权达到最大轮询次数,停止轮询')- }+ // 检查是否达到最大轮询次数+ if (queryCount >= maxQueryCount) {+ reject(new Error('timeout, max poll count reached'))+ return true+ }++ return false+ } catch (error) {+ reject(error)+ return true+ }+ }++ // 设置轮询间隔+ const interval = setInterval(async () => {+ const isFinished = await checkAuthStatus()+ if (isFinished) {+ clearInterval(interval)+ }+ }, 1000)++ // 5分钟后自动停止轮询+ setTimeout(() => {+ clearInterval(interval)+ reject(new Error('timeout'))+ }, 5 * 60 * 1000)+ } catch (error) {+ reject(error)+ }+ })}diff --git a/project/web/src/app/[lng]/chat/[taskId]/components/ChatHeader/index.tsx b/project/web/src/app/[lng]/chat/[taskId]/components/ChatHeader/index.tsxindex 10fb5a9e..daec6e24 100644--- a/project/web/src/app/[lng]/chat/[taskId]/components/ChatHeader/index.tsx+++ b/project/web/src/app/[lng]/chat/[taskId]/components/ChatHeader/index.tsx@@ -2,31 +2,32 @@* ChatHeader - 对话页面顶部导航栏* 显示返回按钮、标题、生成状态*/-'use client'+"use client";-import React, { useState } from 'react'-import { ArrowLeft, Loader2, Star } from 'lucide-react'-import { Button } from '@/components/ui/button'-import RatingModal from '@/components/Chat/Rating'-import { useTransClient } from '@/app/i18n/client'+import React, { useState } from "react";+import { ArrowLeft, Loader2, Share2, Star } from "lucide-react";+import { Button } from "@/components/ui/button";+import RatingModal from "@/components/Chat/Rating";+import { useTransClient } from "@/app/i18n/client";+import ShareModal from "@/components/Share/ShareModal";export interface IChatHeaderProps {/** 任务标题 */- title?: string+ title?: string;/** 默认标题(任务标题为空时显示) */- defaultTitle: string+ defaultTitle: string;/** 是否正在生成 */- isGenerating: boolean+ isGenerating: boolean;/** 生成进度(0-100) */- progress: number+ progress: number;/** 思考中文案 */- thinkingText: string+ thinkingText: string;/** 任务ID(用于评分) */- taskId?: string+ taskId?: string;/** 任务评分(用于显示实星) */- rating?: number | null+ rating?: number | null;/** 返回按钮点击 */- onBack: () => void+ onBack: () => void;}export function ChatHeader({@@ -39,8 +40,10 @@ export function ChatHeader({taskId,rating,}: IChatHeaderProps) {- const { t } = useTransClient('chat')- const [ratingOpen, setRatingOpen] = useState(false)+ const { t } = useTransClient("chat");+ const { t: cgmaterialT } = useTransClient("cgmaterial");+ const [ratingOpen, setRatingOpen] = useState(false);+ const [shareOpen, setShareOpen] = useState(false);return (<header className="flex items-center gap-3 px-4 py-3 bg-background border-b border-border shrink-0">{/* 返回按钮 */}@@ -60,38 +63,53 @@ export function ChatHeader({<Loader2 className="w-4 h-4 animate-spin" /><span>{thinkingText}</span>{progress > 0 && progress < 100 && (- <span className="text-xs text-muted-foreground">({progress}%)</span>+ <span className="text-xs text-muted-foreground">+ ({progress}%)+ </span>)}</div>)}- <div className="flex items-center">- <Button- variant="ghost"- size="icon"- onClick={() => setRatingOpen(true)}- className="w-8 h-8"+ <div className="flex items-center gap-2.5">+ <button+ onClick={() => setShareOpen(true)}+ className="ml-1 text-sm text-muted-foreground sm:inline flex! items-center">- <Star className={`w-5 h-5 ${rating ? 'text-amber-400' : 'text-muted-foreground'}`} {...(rating ? { fill: 'currentColor' } : {})} />- </Button>+ <Button variant="ghost" size="icon" className="w-8 h-8">+ <Share2 className="w-5 h-5" />+ </Button>+ {cgmaterialT("import.shares")}+ </button>{/* 文本提示,移动端隐藏以节省空间 */}<buttononClick={() => setRatingOpen(true)}- className="ml-1 text-sm text-muted-foreground hidden sm:inline"- aria-label={t('task.rate') || 'Rate'}+ className="ml-1 text-sm text-muted-foreground sm:inline flex! items-center"+ aria-label={t("task.rate")}>- {t('task.rate') || '评分'}+ <Button variant="ghost" size="icon" className="w-8 h-8">+ <Star+ className={`w-5 h-5 ${+ rating ? "text-amber-400" : "text-muted-foreground"+ }`}+ {...(rating ? { fill: "currentColor" } : {})}+ />+ </Button>+ {t("task.rate") || "评分"}</button></div></div>+ <ShareModal+ taskId={taskId ?? ""}+ open={shareOpen}+ onOpenChange={(v) => setShareOpen(v)}+ /><RatingModal- taskId={taskId ?? ''}+ taskId={taskId ?? ""}open={ratingOpen}onClose={() => setRatingOpen(false)}onSaved={() => {- setRatingOpen(false)+ setRatingOpen(false);}}/></header>- )+ );}-diff --git a/project/web/src/app/[lng]/chat/[taskId]/utils/convertMessages.ts b/project/web/src/app/[lng]/chat/[taskId]/utils/convertMessages.tsindex e173c493..b1b0e01c 100644--- a/project/web/src/app/[lng]/chat/[taskId]/utils/convertMessages.ts+++ b/project/web/src/app/[lng]/chat/[taskId]/utils/convertMessages.ts@@ -241,8 +241,8 @@ function processUserMessage(}}- // 只有非工具结果的用户消息才显示- if (content && !isToolResult) {+ // 只有非工具结果的用户消息才显示(包含文本或媒体)+ if ((content || medias.length > 0) && !isToolResult) {saveStepsToMessage()displayMessages.push({diff --git a/project/web/src/app/i18n/locales/en/share.json b/project/web/src/app/i18n/locales/en/share.jsonnew file mode 100644index 00000000..ba06532e--- /dev/null+++ b/project/web/src/app/i18n/locales/en/share.json@@ -0,0 +1,31 @@+{+ "title": "Share Conversation",+ "description": "Select messages to share as an image",+ "selectAll": "Select All",+ "selectRecent": "Select Recent",+ "recent5": "Recent 5",+ "recent10": "Recent 10",+ "recent20": "Recent 20",+ "clearSelection": "Clear Selection",+ "selectedCount": "Selected {{count}} messages",+ "cancel": "Cancel",+ "generating": "Generating...",+ "generateAndDownload": "Generate & Download ({{count}} messages)",+ "showMore": "Show more",+ "collapse": "Collapse",+ "share": "Share",+ "appName": "AiToEarn",+ "appUrl": "https://aitoearn.ai"+ ,+ "previewTitle": "Preview",+ "agentShare": "Share via Agent",+ "publishShare": "Share via Publish",+ "download": "Download",+ "downloadFailed": "Download failed",+ "agentSharePrompt": "Share this image to social media. Copy write freely.",+ "agentShareSaved": "Ready to share on Home",+ "agentShareFailed": "Failed to prepare agent share",+ "publishShareDescription": "I generated this conversation on AiToEarn using agent, check it out!",+ "noAvailablePublishAccounts": "No available accounts to publish"+}+diff --git a/project/web/src/app/i18n/locales/zh-CN/share.json b/project/web/src/app/i18n/locales/zh-CN/share.jsonnew file mode 100644index 00000000..94e0846d--- /dev/null+++ b/project/web/src/app/i18n/locales/zh-CN/share.json@@ -0,0 +1,31 @@+{+ "title": "分享对话",+ "description": "选择要作为图片分享的消息",+ "selectAll": "选取全部",+ "selectRecent": "选最近几条",+ "recent5": "最近5条",+ "recent10": "最近10条",+ "recent20": "最近20条",+ "clearSelection": "清空选中",+ "selectedCount": "已选中 {{count}} 条消息",+ "cancel": "取消",+ "generating": "生成中...",+ "generateAndDownload": "生成并下载({{count}} 条)",+ "showMore": "展开更多",+ "collapse": "收起",+ "share": "分享",+ "appName": "AiToEarn",+ "appUrl": "https://aitoearn.ai"+ ,+ "previewTitle": "预览",+ "agentShare": "通过 Agent 分享",+ "publishShare": "通过发布分享",+ "download": "下载",+ "downloadFailed": "下载失败",+ "agentSharePrompt": "将这张图片发布到社交媒体,文案自由发挥",+ "agentShareSaved": "已准备好在首页分享",+ "agentShareFailed": "准备分享失败",+ "publishShareDescription": "我在aitoearn用agent生成的对话太有意思了,你也来试试吧!",+ "noAvailablePublishAccounts": "没有可用的发布账号"+}+diff --git a/project/web/src/components/Chat/ActionCard/index.tsx b/project/web/src/components/Chat/ActionCard/index.tsxindex b4fe866a..f87ca9b9 100644--- a/project/web/src/components/Chat/ActionCard/index.tsx+++ b/project/web/src/components/Chat/ActionCard/index.tsx@@ -7,7 +7,7 @@'use client'import { useState } from 'react'-import { useRouter, useParams } from 'next/navigation'+import { useRouter, useParams, usePathname } from 'next/navigation'import { Link2, RefreshCw, Send, ArrowRight, AlertCircle } from 'lucide-react'import { cn } from '@/lib/utils'import { useTransClient } from '@/app/i18n/client'@@ -16,6 +16,7 @@ import { useUserStore } from '@/store/user'import { toast } from '@/lib/toast'import { openLoginModal } from '@/store/loginModal'import AddAccountModal from '@/app/[lng]/accounts/components/AddAccountModal'+import { useAgentStore } from '@/store/agent'import type { IActionCard } from '@/store/agent/agent.types'export interface IActionCardProps {@@ -65,10 +66,14 @@ interface IActionConfig {*/export function ActionCard({ action, className }: IActionCardProps) {const router = useRouter()+ const pathname = usePathname()const { lng } = useParams()const { t } = useTransClient('chat')const token = useUserStore(state => state.token)-++ // Agent store 方法+ const { continueTask } = useAgentStore()+// 添加账号弹窗状态const [addAccountVisible, setAddAccountVisible] = useState(false)@@ -142,6 +147,39 @@ export function ActionCard({ action, className }: IActionCardProps) {const config = getActionConfig()+ /**+ * 处理账号添加成功+ */+ const handleAccountAddSuccess = async () => {+ // 关闭弹窗+ setAddAccountVisible(false)++ // 检查是否在 chat 页面+ if (pathname.includes('/chat/')) {+ // 提取 taskId+ const pathParts = pathname.split('/')+ const taskIdIndex = pathParts.findIndex(part => part === 'chat')+ if (taskIdIndex !== -1 && pathParts[taskIdIndex + 1]) {+ const taskId = pathParts[taskIdIndex + 1]++ // 自动发送消息+ const platformName = getPlatformDisplayName(action.platform)+ const autoMessage = `I have added the "${platformName}" channel account, please continue.`++ try {+ await continueTask({+ prompt: autoMessage,+ medias: [],+ t: t as (key: string) => string,+ taskId,+ })+ } catch (error) {+ console.error('Auto send message failed:', error)+ }+ }+ }+ }+// 处理按钮点击const handleClick = () => {const platform = action.platform || ''@@ -225,7 +263,7 @@ export function ActionCard({ action, className }: IActionCardProps) {<AddAccountModalopen={addAccountVisible}onClose={() => setAddAccountVisible(false)}- onAddSuccess={() => setAddAccountVisible(false)}+ onAddSuccess={handleAccountAddSuccess}showSpaceSelector={true}/>)}diff --git a/project/web/src/components/Chat/Rating/RatingModal.tsx b/project/web/src/components/Chat/Rating/RatingModal.tsxindex 5d179671..5199520e 100644--- a/project/web/src/components/Chat/Rating/RatingModal.tsx+++ b/project/web/src/components/Chat/Rating/RatingModal.tsx@@ -92,12 +92,7 @@ export const RatingModal: React.FC<RatingModalProps> = ({ taskId, open, onClose,onOk={handleSubmit}okText={t('rating.submit') || '提交'}cancelText={t('rating.cancel') || '取消'}- confirmLoading={false}- footer={loading ? (- <div className="flex items-center justify-end w-full">- <Loader2 className="w-5 h-5 animate-spin" />- </div>- ) : undefined}+ confirmLoading={loading}width={520}><div className="space-y-4 w-full">diff --git a/project/web/src/components/Chat/TaskCard/index.tsx b/project/web/src/components/Chat/TaskCard/index.tsxindex 8e33368c..627015bc 100644--- a/project/web/src/components/Chat/TaskCard/index.tsx+++ b/project/web/src/components/Chat/TaskCard/index.tsx@@ -11,6 +11,7 @@ import {CheckCircle2,Loader2,MessageSquare,+ Share2,Star,Trash2,} from "lucide-react";@@ -18,7 +19,6 @@ import { useRouter } from "next/navigation";import { useState } from "react";import { useTransClient } from "@/app/i18n/client";import { useGetClientLng } from "@/hooks/useSystem";-import { toast } from "@/lib/toast";import { cn, formatRelativeTime } from "@/lib/utils";export interface ITaskCardProps {@@ -44,6 +44,8 @@ export interface ITaskCardProps {showInlineRating?: boolean;/** 自定义类名 */className?: string;+ /** 分享回调(由父组件触发 ShareModal) */+ onShare?: (id: string) => void;}/** 获取状态显示配置 */@@ -106,12 +108,14 @@ export function TaskCard({className,onSelect,onRateClick,+ onShare,}: ITaskCardProps) {const router = useRouter();const lng = useGetClientLng();const { t } = useTransClient("chat");const [isDeleting, setIsDeleting] = useState(false);- const [isProcessing, setIsProcessing] = useState(false);++ const { t: cgmaterialT } = useTransClient("cgmaterial");const statusConfig = getStatusConfig(status, t as (key: string) => string);@@ -139,10 +143,6 @@ export function TaskCard({}};- // Note: share and public-link actions intentionally removed from UI per request.-- // Inline rating handlers removed — rating UI hidden on TaskCard.-/** 触发评分回调(由历史列表等外部组件使用) */const handleRateClick = (e: React.MouseEvent) => {e.stopPropagation();@@ -151,6 +151,12 @@ export function TaskCard({onRateClick(id);};+ const handleShareClick = (e?: React.MouseEvent) => {+ e?.stopPropagation();+ e?.preventDefault();+ if (typeof onShare === "function") onShare(id);+ };+return (<divonClick={handleClick}@@ -210,8 +216,16 @@ export function TaskCard({className={`w-3 h-3 ${rating ? "text-amber-400" : ""}`}{...(rating ? { fill: "currentColor" } : {})}/>+ <span className="hidden sm:inline">{t("task.rate") || "Rate"}</span>+ </button>+ <button+ onClick={handleShareClick}+ className="flex items-center gap-1 px-2 py-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors text-xs opacity-60 hover:opacity-100"+ aria-label="rate"+ >+ <Share2 className={`w-3 h-3`} /><span className="hidden sm:inline">- {t("task.rate" as any) || "Rate"}+ {cgmaterialT("import.shares")}</span></button><button@@ -226,7 +240,7 @@ export function TaskCard({<Trash2 className="w-3 h-3" />)}<span className="hidden sm:inline">- {t("task.delete" as any) || "Delete"}+ {t("task.delete") || "Delete"}</span></button></div>diff --git a/project/web/src/components/Chat/TaskHistoryList.tsx b/project/web/src/components/Chat/TaskHistoryList.tsxindex 222c9509..5729df05 100644--- a/project/web/src/components/Chat/TaskHistoryList.tsx+++ b/project/web/src/components/Chat/TaskHistoryList.tsx@@ -6,6 +6,7 @@import React, { useState } from "react";import { TaskCard, TaskCardSkeleton } from "@/components/Chat";+import ShareModal from "@/components/Share/ShareModal";import RatingModal from "@/components/Chat/Rating";import { agentApi, type TaskListItem } from "@/api/agent";import { toast } from "@/lib/toast";@@ -33,6 +34,7 @@ export const TaskHistoryList = ({}: ITaskHistoryListProps) => {const { t } = useTransClient("chat");const [ratingModalFor, setRatingModalFor] = useState<string | null>(null);+ const [shareTaskId, setShareTaskId] = useState<string | null>(null);const handleRateClick = (taskId: string) => {setRatingModalFor(taskId);@@ -90,6 +92,7 @@ export const TaskHistoryList = ({rating={task.rating}onDelete={() => handleDelete(String(task.id))}onRateClick={() => handleRateClick(task.id)}+ onShare={() => setShareTaskId(String(task.id))}/>);@@ -116,6 +119,14 @@ export const TaskHistoryList = ({setRatingModalFor(null);}}/>+ {/* ShareModal centralized here to avoid overlay click propagation issues */}+ <ShareModal+ taskId={shareTaskId ?? ""}+ open={!!shareTaskId}+ onOpenChange={(v) => {+ if (!v) setShareTaskId(null);+ }}+ /></div>);};diff --git a/project/web/src/components/Home/HomeChat/index.tsx b/project/web/src/components/Home/HomeChat/index.tsxindex fb2db93d..eec3fb2d 100644--- a/project/web/src/components/Home/HomeChat/index.tsx+++ b/project/web/src/components/Home/HomeChat/index.tsx@@ -14,6 +14,7 @@ import { useTransClient } from '@/app/i18n/client'import { useAgentStore } from '@/store/agent'import { useUserStore } from '@/store/user'import { useMediaUpload } from '@/hooks/useMediaUpload'+import { useSearchParams } from 'next/navigation'import { toast } from '@/lib/toast'import { cn } from '@/lib/utils'import { AccountPlatInfoArr } from '@/app/config/platConfig'@@ -101,6 +102,7 @@ export function HomeChat({// 使用媒体上传 Hookconst {medias,+ setMedias,isUploading,handleMediasChange,handleMediaRemove,@@ -109,6 +111,50 @@ export function HomeChat({onError: () => toast.error(t('media.uploadFailed')),})+ const searchParams = useSearchParams()++ useEffect(() => {+ try {+ if (!searchParams) return+ const aiGenerated = searchParams.get('aiGenerated')+ if (aiGenerated === 'true') {+ const mediasParam = searchParams.get('medias')+ const descriptionParam = searchParams.get('description')+ if (descriptionParam) {+ setInputValue(decodeURIComponent(descriptionParam) || defaultPrompt)+ }+ if (mediasParam) {+ try {+ const medias = JSON.parse(decodeURIComponent(mediasParam))+ if (Array.isArray(medias) && medias.length > 0) {+ setMedias((prev) => [+ {+ id: `shared-${Date.now()}`,+ url: medias[0].url,+ type: 'image',+ file: undefined,+ },+ ...prev,+ ])+ }+ } catch (e) {+ // ignore parse errors+ }+ }+ // remove params to avoid re-processing (replaceState)+ if (typeof window !== 'undefined') {+ const url = new URL(window.location.href)+ url.searchParams.delete('aiGenerated')+ url.searchParams.delete('medias')+ url.searchParams.delete('description')+ window.history.replaceState({}, '', url.toString())+ }+ }+ } catch (e) {+ // ignore+ }+ }, [searchParams])+// 全局 Storeconst { setPendingTask, setActionContext } = useAgentStore()diff --git a/project/web/src/components/Share/ShareModal.tsx b/project/web/src/components/Share/ShareModal.tsxnew file mode 100644index 00000000..3f852837--- /dev/null+++ b/project/web/src/components/Share/ShareModal.tsx@@ -0,0 +1,492 @@+"use client";++import React, { useCallback, useEffect, useMemo, useState } from "react";+import { agentApi, type TaskDetail, type TaskMessage } from "@/api/agent";+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogHeader,+ DialogTitle,+ DialogTrigger,+} from "@/components/ui/dialog";+import { Button } from "@/components/ui/button";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import { Skeleton } from "@/components/ui/skeleton";+import { generateImageFromMessages } from "./generateShareImages";+import ChatMessage from "@/components/Chat/ChatMessage";+import { useUserStore } from "@/store/user";+import { toast } from "@/lib/toast";+import type { IDisplayMessage } from "@/store/agent";+import { convertMessages } from "@/app/[lng]/chat/[taskId]/utils";+import { useTransClient } from "@/app/i18n/client";+import SharePreviewModal from "./SharePreviewModal";++interface ShareModalProps {+ taskId: string;+ open?: boolean;+ onOpenChange?: (open: boolean) => void;+ trigger?: React.ReactNode;+}++export const ShareModal = ({+ taskId,+ open = false,+ onOpenChange,+ trigger,+}: ShareModalProps) => {+ const { t } = useTransClient('share');+ const [visible, setVisible] = useState(open);+ const [loading, setLoading] = useState(false);+ const [taskDetail, setTaskDetail] = useState<TaskDetail | null>(null);+ const [selectedIds, setSelectedIds] = useState<string[]>([]);+ const [previewOpen, setPreviewOpen] = useState(false);+ const [previewBlobs, setPreviewBlobs] = useState<Blob[]>([]);+ const [previewUrls, setPreviewUrls] = useState<string[]>([]);+ const user = useUserStore((s) => s.userInfo);++ useEffect(() => {+ setVisible(open);+ }, [open]);++ useEffect(() => {+ if (!taskId || !visible) return;++ const load = async () => {+ try {+ setLoading(true);+ const res = await agentApi.getTaskDetail(taskId);++ if (res?.data) {+ setTaskDetail(res.data);+ // 使用转换后的 display messages 的 id 作为默认选中(避免后端原始消息 id 与前端展示 id 不一致)+ const converted = convertMessages(res.data.messages || []);+ const displayIds = converted.map((m) => m.id);+ setSelectedIds(displayIds);+ // 默认全部折叠+ setCollapsedIds(new Set(displayIds));+ } else {+ toast.error("Failed to load task detail: No data received");+ }+ } catch (err) {+ console.error("Failed to load task detail:", err);+ const errorMessage =+ err instanceof Error ? err.message : "Unknown error occurred";+ toast.error(`Failed to load task detail: ${errorMessage}`);+ } finally {+ setLoading(false);+ }+ };++ load();+ }, [taskId, visible]);++ const messages = useMemo(() => {+ if (!taskDetail?.messages) return [];+ return convertMessages(taskDetail.messages);+ }, [taskDetail?.messages]);++ // 在列表中始终显示所有消息(复选框仅用于高亮与导出选择)+ const displayMessages = useMemo(() => {+ return messages;+ }, [messages]);++ // 折叠状态:记录被折叠的 message id 集合+ const [collapsedIds, setCollapsedIds] = useState<Set<string>>(new Set());+ const toggleCollapse = (id: string) => {+ setCollapsedIds((prev) => {+ const next = new Set(prev);+ if (next.has(id)) next.delete(id);+ else next.add(id);+ return next;+ });+ };+ // refs for measuring rendered message height+ const messageRefs = React.useRef<Map<string, HTMLDivElement>>(new Map());+ const [longIds, setLongIds] = useState<Set<string>>(new Set());++ React.useEffect(() => {+ const measure = () => {+ const next = new Set<string>();+ messageRefs.current.forEach((el, id) => {+ try {+ // threshold changed to 60+ if (el && el.scrollHeight > 60) next.add(id);+ } catch (e) {+ // ignore+ }+ });+ setLongIds(next);+ };++ // initial measure after a tick to allow children render+ const t = setTimeout(measure, 150);+ const ro = new ResizeObserver(measure);+ messageRefs.current.forEach((el) => {+ if (el) ro.observe(el);+ });+ window.addEventListener('resize', measure);+ return () => {+ clearTimeout(t);+ ro.disconnect();+ window.removeEventListener('resize', measure);+ };+ }, [displayMessages]);+ const toggleSelect = useCallback((id: string) => {+ setSelectedIds(prev => {+ if (prev.includes(id)) return prev.filter(p => p !== id);+ return [...prev, id];+ });+ }, []);++ const handleOpenChange = useCallback(+ (open: boolean) => {+ setVisible(open);+ onOpenChange?.(open);+ },+ [onOpenChange]+ );++ const handleGenerateAndDownload = useCallback(async () => {+ if (!messages || messages.length === 0) {+ toast.error("No messages available");+ return;+ }++ const selectedMessages = messages.filter((m) => selectedIds.includes(m.id));++ if (selectedMessages.length === 0) {+ toast.error("Please select at least one message to share");+ return;+ }++ // 生成后展示预览(不立即下载)+ setLoading(true);+ try {+ const blobs = await generateImageFromMessages(+ selectedMessages,+ user?.name,+ { appTitle: t('appName'), appUrl: t('appUrl') }+ );+ if (!blobs || blobs.length === 0) throw new Error("No images were generated");+ setPreviewBlobs(blobs);+ const urls = blobs.map((b) => URL.createObjectURL(b));+ setPreviewUrls(urls);+ setPreviewOpen(true);+ } catch (err) {+ console.error("Failed to generate images:", err);+ const errorMessage =+ err instanceof Error ? err.message : "Unknown error occurred";+ toast.error(`Failed to generate images: ${errorMessage}`);+ } finally {+ setLoading(false);+ }+ }, [messages, selectedIds, taskId, user?.name, onOpenChange]);++ // 辅助函数:下载图片+ const downloadImages = async (+ blobs: Blob[],+ taskId: string+ ): Promise<void> => {+ const downloadPromises = blobs.map((blob, index) => {+ return new Promise<void>((resolve, reject) => {+ try {+ const a = document.createElement("a");+ const url = URL.createObjectURL(blob);+ a.href = url;+ // 为长图使用不同的命名+ const fileName =+ blobs.length === 1+ ? `aitoearn_conversation_${taskId}.png`+ : `aitoearn_${taskId}_${index + 1}.png`;+ a.download = fileName;+ document.body.appendChild(a);+ a.click();+ a.remove();+ URL.revokeObjectURL(url);+ resolve();+ } catch (err) {+ reject(err);+ }+ });+ });++ await Promise.all(downloadPromises);+ };++ const messageListContent = loading ? (+ <div className="space-y-4">+ {Array.from({ length: 6 }).map((_, i) => (+ <div key={i} className="flex items-start gap-3">+ <Skeleton className="w-10 h-10 rounded-full" />+ <div className="flex-1 space-y-2">+ <Skeleton className="h-4 w-1/4" />+ <Skeleton className="h-3 w-full" />+ <Skeleton className="h-3 w-5/6" />+ </div>+ </div>+ ))}+ </div>+ ) : (+ displayMessages.map((message) => {+ const isUser = message.role === 'user';+ const isSelected = selectedIds.includes(message.id);+ const isCollapsed = collapsedIds.has(message.id);+ const isLong = longIds.has(message.id) || !!(message.content && message.content.length > 60) || (message.medias && message.medias.length > 0);++ const checkbox = (+ <input+ type="checkbox"+ checked={isSelected}+ onChange={(e) => {+ if (e.target.checked) {+ setSelectedIds((prev) => Array.from(new Set([...prev, message.id])));+ } else {+ setSelectedIds((prev) => prev.filter((id) => id !== message.id));+ }+ }}+ className="mt-1"+ />+ );++ // click handler for message area: toggle selection unless inner interactive element clicked+ const onMessageClick = (e: React.MouseEvent) => {+ const target = e.target as HTMLElement | null;+ if (!target) return;+ // if clicked inside an interactive element, ignore+ if (target.closest('a,button,input,textarea,select,video')) return;+ toggleSelect(message.id);+ };++ // role-based base and highlight colors (now unified; use grayish highlight)+ const ROLE_BASE: Record<string, string> = {+ user: '#ffffff',+ assistant: '#ffffff',+ };+ // make highlight very subtle (lighter)+ const ROLE_HIGHLIGHT: Record<string, string> = {+ user: '#fbfbfd',+ assistant: '#fbfbfd',+ };+ const baseMessageStyle: React.CSSProperties = {+ padding: 12,+ borderRadius: 8,+ };+ const roleBg = isUser ? ROLE_BASE.user : ROLE_BASE.assistant;+ const selectedBg = isUser ? ROLE_HIGHLIGHT.user : ROLE_HIGHLIGHT.assistant;+ const selectedStyle: React.CSSProperties = {+ ...baseMessageStyle,+ background: selectedBg,+ boxShadow: 'inset 0 0 0 1px rgba(0,0,0,0.02)'+ };+ const defaultStyle: React.CSSProperties = {+ ...baseMessageStyle,+ background: roleBg+ };++ return (+ <div+ key={message.id}+ className="relative"+ >+ <div+ onClick={onMessageClick}+ role="button"+ tabIndex={0}+ onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') toggleSelect(message.id); }}+ className={`flex items-start gap-3`}+ style={isSelected ? selectedStyle : defaultStyle}+ ref={(el) => {+ if (el) messageRefs.current.set(message.id, el as HTMLDivElement);+ else messageRefs.current.delete(message.id);+ }}+ >+ {!isUser && (+ <div className="mt-1">+ {checkbox}+ </div>+ )}++ <div className="flex-1 min-w-0">+ <div style={isLong && isCollapsed ? { maxHeight: 40, overflow: 'hidden', position: 'relative' } : undefined}>+ <ChatMessage+ role={message.role === 'system' ? 'assistant' : message.role}+ content={message.content}+ medias={message.medias}+ status={message.status}+ errorMessage={message.errorMessage}+ createdAt={message.createdAt}+ steps={message.steps}+ actions={message.actions}+ className="max-w-full"+ />+ {isLong && isCollapsed && (+ <div style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: 40, background: 'linear-gradient(rgba(255,255,255,0), rgba(255,255,255,0.95))' }} />+ )}+ </div>+ {/* fold button moved to top-right for better visibility */}+ </div>++ {isUser && (+ <div className="mt-1">+ {checkbox}+ </div>+ )}+ </div>++ {/* top-right collapse button */}+ {isLong && (+ <button+ type="button"+ onClick={(e) => { e.stopPropagation(); toggleCollapse(message.id); }}+ title={isCollapsed ? t('showMore') : t('collapse')}+ className={`absolute top-3 w-9 h-9 flex items-center justify-center bg-white border border-border rounded-full shadow-sm hover:bg-muted/80`}+ style={{ zIndex: 20, left: isUser ? '12px' : undefined, right: isUser ? undefined : '12px' } as React.CSSProperties}+ >+ <span style={{ fontSize: 12 }}>{isCollapsed ? '▾' : '▴'}</span>+ </button>+ )}+ </div>+ );+ })+ );++ return (+ <Dialog open={visible} onOpenChange={handleOpenChange}>+ <DialogTrigger asChild>{trigger}</DialogTrigger>+ <DialogContent className="max-w-4xl max-h-[90vh] overflow-hidden">+ <DialogHeader>+ <DialogTitle>{t('title')}</DialogTitle>+ <DialogDescription>{t('description')}</DialogDescription>+ </DialogHeader>++ <div className="flex flex-col gap-4 h-full max-h-[calc(90vh-120px)]">+ {/* 操作按钮区域 */}+ <div className="flex items-center justify-between gap-2 p-3 border rounded-lg bg-muted/30">+ <div className="flex items-center gap-2">+ <Button+ variant="outline"+ size="sm"+ onClick={() => {+ const allIds = displayMessages.map(m => m.id);+ setSelectedIds(allIds);+ }}+ className="cursor-pointer"+ >+ {t('selectAll')}+ </Button>++ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button+ variant="outline"+ size="sm"+ className="cursor-pointer"+ >+ {t('selectRecent')}+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent>+ <DropdownMenuItem+ onClick={() => {+ const recentCount = Math.min(5, displayMessages.length);+ const recentIds = displayMessages.slice(-recentCount).map(m => m.id);+ setSelectedIds(recentIds);+ }}+ >+ {t('recent5')}+ </DropdownMenuItem>+ <DropdownMenuItem+ onClick={() => {+ const recentCount = Math.min(10, displayMessages.length);+ const recentIds = displayMessages.slice(-recentCount).map(m => m.id);+ setSelectedIds(recentIds);+ }}+ >+ {t('recent10')}+ </DropdownMenuItem>+ <DropdownMenuItem+ onClick={() => {+ const recentCount = Math.min(20, displayMessages.length);+ const recentIds = displayMessages.slice(-recentCount).map(m => m.id);+ setSelectedIds(recentIds);+ }}+ >+ {t('recent20')}+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>++ <Button+ variant="outline"+ size="sm"+ onClick={() => setSelectedIds([])}+ className="cursor-pointer"+ >+ {t('clearSelection')}+ </Button>+ </div>++ <div className="text-sm text-muted-foreground">+ {t('selectedCount', { count: selectedIds.length })}+ </div>+ </div>++ {/* 消息选择区域 */}+ <div className="flex-1 overflow-y-auto border rounded-lg p-4 space-y-4">+ {messageListContent}+ </div>++ <div className="flex items-center justify-end gap-2">+ <Button+ variant="secondary"+ onClick={() => {+ setVisible(false);+ onOpenChange?.(false);+ }}+ >+ {t('cancel')}+ </Button>+ <Button+ onClick={handleGenerateAndDownload}+ disabled={loading || selectedIds.length === 0}+ className="bg-primary text-white"+ >+ {loading ? t('generating') : t('generate')}+ </Button>+ </div>+ </div>+ </DialogContent>+ {/* Share preview modal */}+ {previewOpen && (+ // lazy load the preview modal component to avoid bundle size; import statically here for simplicity+ <div>+ <SharePreviewModal+ open={previewOpen}+ onClose={() => {+ // revoke object urls+ previewUrls.forEach((u) => {+ try { URL.revokeObjectURL(u) } catch (e) {}+ });+ setPreviewOpen(false);+ setPreviewBlobs([]);+ setPreviewUrls([]);+ onOpenChange?.(false);+ setVisible(false);+ }}+ blobs={previewBlobs}+ urls={previewUrls}+ taskId={taskId}+ />+ </div>+ )}+ </Dialog>+ );+};++export default ShareModal;diff --git a/project/web/src/components/Share/SharePreviewModal.tsx b/project/web/src/components/Share/SharePreviewModal.tsxnew file mode 100644index 00000000..a933ae03--- /dev/null+++ b/project/web/src/components/Share/SharePreviewModal.tsx@@ -0,0 +1,215 @@+"use client";++import React, { useState } from "react";+import { Button } from "@/components/ui/button";+import { Modal } from "@/components/ui/modal";+import { useRouter } from "next/navigation";+import { useTransClient } from "@/app/i18n/client";+import { toast } from "@/lib/toast";+import { useAccountStore } from "@/store/account";+import { AccountPlatInfoMap } from "@/app/config/platConfig";+import { PubType } from "@/app/config/publishConfig";+import { uploadToOss } from "@/api/oss";+import { usePublishDialogData } from "../PublishDialog/usePublishDialogData";+import { usePublishDialogStorageStore } from "../PublishDialog/usePublishDialogStorageStore";++interface SharePreviewModalProps {+ open: boolean;+ onClose: () => void;+ blobs: Blob[];+ urls: string[]; // object URLs+ taskId: string;+}++export const SharePreviewModal = ({+ open,+ onClose,+ blobs,+ urls,+ taskId,+}: SharePreviewModalProps) => {+ const { t } = useTransClient("share");+ const router = useRouter();+ const { accountList, getAccountList } = useAccountStore();+ const [uploading, setUploading] = useState(false);++ const downloadBlobs = async () => {+ try {+ for (let i = 0; i < blobs.length; i++) {+ const blob = blobs[i];+ const a = document.createElement("a");+ const url = URL.createObjectURL(blob);+ a.href = url;+ a.download =+ blobs.length === 1+ ? `aitoearn_conversation_${taskId}.png`+ : `aitoearn_${taskId}_${i + 1}.png`;+ document.body.appendChild(a);+ a.click();+ a.remove();+ URL.revokeObjectURL(url);+ }+ toast.success(t("download") || "Downloaded");+ } catch (e) {+ console.error(e);+ toast.error(t("downloadFailed") || "Download failed");+ }+ };++ const handleAgentShare = async () => {+ try {+ setUploading(true);+ // upload blobs (if available) and get urls+ const targets = blobs && blobs.length > 0 ? blobs : [];+ let uploadedUrls: string[] = [];+ if (targets.length > 0) {+ for (let i = 0; i < targets.length; i++) {+ const file = new File(+ [targets[i]],+ `aitoearn_export_${Date.now()}_${i}.png`,+ { type: targets[i].type || "image/png" }+ );+ try {+ const url = await uploadToOss(file);+ uploadedUrls.push(url as string);+ } catch (err) {+ console.error("Upload failed for blob", err);+ }+ }+ }++ const payloadPrompt =+ t("agentSharePrompt") ||+ "Share this image to social media. Copy write freely.";+ const params = new URLSearchParams();+ params.set("aiGenerated", "true");+ params.set(+ "medias",+ encodeURIComponent(+ JSON.stringify(uploadedUrls.map((u) => ({ type: "IMAGE", url: u })))+ )+ );+ params.set("description", encodeURIComponent(payloadPrompt));++ onClose();+ router.push(`/?${params.toString()}`);+ toast.success(t("agentShareSaved") || "Ready to share on Home");+ } catch (e) {+ console.error(e);+ toast.error(t("agentShareFailed") || "Failed to prepare agent share");+ } finally {+ setUploading(false);+ }+ };++ const handlePublishShare = async () => {+ try {+ usePublishDialogStorageStore.getState().clearPubData();+ setUploading(true);+ // ensure accounts loaded+ if (!accountList || accountList.length === 0) {+ await getAccountList();+ }+ // filter accounts that support ImageText and are online (status !== 0)+ const candidates = (useAccountStore.getState().accountList || []).filter(+ (acc) => {+ const plat = AccountPlatInfoMap.get(acc.type as any);+ return acc.status !== 0 && plat?.pubTypes?.has(PubType.ImageText);+ }+ );++ if (!candidates || candidates.length === 0) {+ toast.error(+ t("noAvailablePublishAccounts") || "No available accounts to publish"+ );+ return;+ }++ // Prepare medias param for accounts page (upload blobs then navigate)+ const targets = blobs && blobs.length > 0 ? blobs : [];+ let uploadedUrls: string[] = [];+ if (targets.length > 0) {+ if (targets.length > 0) {+ for (let i = 0; i < targets.length; i++) {+ const file = new File(+ [targets[i]],+ `aitoearn_export_${Date.now()}_${i}.png`,+ { type: targets[i].type || "image/png" }+ );+ try {+ const url = await uploadToOss(file);+ uploadedUrls.push(url as string);+ } catch (err) {+ console.error("Upload failed for blob", err);+ }+ }+ }+ } else {+ // fallback to provided urls+ uploadedUrls = urls.slice();+ }++ const medias = uploadedUrls.map((u) => ({ type: "IMAGE", url: u }));+ const title = "";+ const description =+ t("publishShareDescription") ||+ "I generated this conversation on aitoearn using agent, check it out!";+ const tags = ["aitoearn", "agent"];++ // Build URL params and navigate to /accounts to trigger publish dialog filling+ const params = new URLSearchParams();+ params.set("aiGenerated", "true");+ params.set("medias", encodeURIComponent(JSON.stringify(medias)));+ params.set("description", encodeURIComponent(description));+ params.set("title", encodeURIComponent(title));+ params.set("tags", encodeURIComponent(JSON.stringify(tags)));+ // set accountId to first candidate for default selection+ params.set("accountId", candidates[0].id);++ onClose();+ router.push(`/accounts?${params.toString()}`);+ } catch (e) {+ console.error(e);+ toast.error(t("publishShareFailed") || "Failed to prepare publish");+ } finally {+ setUploading(false);+ }+ };++ return (+ <Modal open={open} onCancel={onClose} title={t("previewTitle")}>+ <div className="max-w-3xl mx-auto">+ <div className="bg-white rounded-md border p-4 flex justify-center">+ {urls[0] ? (+ <img+ src={urls[0]}+ alt="preview"+ className="max-h-[40vh] object-contain"+ />+ ) : (+ <div className="text-sm text-muted-foreground">+ {t("noPreview")}+ </div>+ )}+ </div>++ <div className="mt-4 flex items-center justify-end gap-2">+ <div className="flex items-center gap-3">+ {/* show nothing; buttons will show loading state */}+ </div>+ <Button variant="outline" onClick={handleAgentShare} loading={uploading}>+ {t("agentShare")}+ </Button>+ <Button variant="outline" onClick={handlePublishShare} loading={uploading}>+ {t("publishShare")}+ </Button>+ <Button onClick={downloadBlobs} disabled={uploading}>+ {t("download")}+ </Button>+ </div>+ </div>+ </Modal>+ );+};++export default SharePreviewModal;diff --git a/project/web/src/components/Share/generateShareImages.ts b/project/web/src/components/Share/generateShareImages.tsnew file mode 100644index 00000000..7140d877--- /dev/null+++ b/project/web/src/components/Share/generateShareImages.ts@@ -0,0 +1,482 @@+import html2canvas from "html2canvas-pro";+import React from "react";+import { createRoot } from "react-dom/client";+import type { IDisplayMessage } from "@/store/agent";+import ChatMessage from "@/components/Chat/ChatMessage";+import { getOssUrl } from "@/utils/oss";+import logo from "@/assets/images/logo.png";+// upload handled by caller (SharePreviewModal)++export async function generateImageFromMessages(+ messages: IDisplayMessage[],+ userName?: string,+ options?: { appTitle?: string; appUrl?: string }+): Promise<Blob[]> {+ // 将所有消息渲染到一张长图中+ const blob = await generateImageFromAllMessages(messages, userName, options);+ if (!blob) {+ throw new Error('Failed to generate combined image');+ }+ return [blob];+}++async function generateImageFromAllMessages(+ messages: IDisplayMessage[],+ userName?: string,+ options?: { appTitle?: string; appUrl?: string; upload?: boolean }+): Promise<Blob | null> {+ // 处理消息中的媒体URL,确保使用代理URL+ const processedMessages = messages.map(message => ({+ ...message,+ medias: message.medias?.map(media => ({+ ...media,+ url: getOssUrl(media.url)+ })) || []+ }));++ // 创建临时容器+ const container = document.createElement("div");+ container.style.position = "fixed";+ container.style.left = "-9999px";+ container.style.top = "0";+ container.style.width = "600px";+ container.style.background = "white";+ container.style.padding = "20px";+ container.style.fontFamily = "Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial";++ // 使用 React 渲染所有消息组件+ const root = createRoot(container);+ await new Promise<void>((resolve) => {+ const messageElements = processedMessages.map((message, index) =>+ React.createElement(ChatMessage, {+ key: message.id || index,+ role: message.role === 'system' ? 'assistant' : message.role,+ content: message.content,+ medias: message.medias,+ status: message.status,+ errorMessage: message.errorMessage,+ createdAt: message.createdAt,+ steps: message.steps,+ actions: [], // 不渲染 actions,避免路由相关错误+ className: 'max-w-full'+ })+ );++ // header 包含 logo 和标题+ const appTitle = options?.appTitle || 'AiToEarn';+ const appUrl = options?.appUrl || 'https://aitoearn.ai';+ const headerEl = React.createElement(+ 'div',+ { className: 'flex items-center gap-3 mb-4' },+ React.createElement('img', {+ src: logo.src || logo,+ style: { width: '40px', height: '40px', borderRadius: '8px' },+ }),+ React.createElement(+ 'div',+ { style: { display: 'flex', flexDirection: 'column' } },+ React.createElement('div', { style: { fontSize: '18px', fontWeight: 700 } }, appTitle),+ React.createElement('div', { style: { fontSize: '12px', color: '#6b7280' } }, appUrl)+ )+ );++ root.render(+ React.createElement(+ 'div',+ { className: 'flex flex-col gap-4' },+ headerEl,+ // 所有消息内容+ ...messageElements,+ // 用户信息+ userName &&+ React.createElement(+ 'div',+ {+ className: 'text-xs text-muted-foreground mt-4 pt-4 border-t border-gray-200',+ style: { marginTop: '16px', paddingTop: '12px', borderTop: '1px solid #eef2f7' },+ },+ `Shared by ${userName}`+ )+ )+ );+ // 等待组件渲染完成+ setTimeout(async () => {+ // 替换所有img和video元素的URL为代理地址+ replaceMediaUrlsWithProxy(container);+ // 等待视频首帧加载完成+ await ensureVideoThumbnails(container);+ // 规范化媒体容器样式(截图时避免因 bg-muted 等类导致气泡看起来变淡)+ // 调暗/强化 AI 气泡对比,避免在消息较少时 AI 气泡过淡+ dimAssistantBubbles(container);+ normalizeMediaWrapperStyles(container);+ resolve();+ }, 1000); // 增加等待时间确保所有消息和视频都渲染完成+ });++ document.body.appendChild(container);++ try {+ // 确保所有图片已加载并且字体就绪,避免因未加载资源导致导出不全+ await waitForImagesToLoad(container);+ await (document as any).fonts?.ready;+ // 确保容器高度被正确计算+ container.style.height = `${container.scrollHeight}px`;++ const canvas = await html2canvas(container, {+ scale: 2, // 高分辨率+ useCORS: true, // 【重要】开启跨域配置+ allowTaint: true, // 允许跨域图片+ backgroundColor: "#ffffff",+ logging: process.env.NODE_ENV === "development",+ imageTimeout: 15000, // 增加超时时间处理更多内容+ removeContainer: false,+ // 确保捕获完整的高度+ height: container.scrollHeight,+ windowHeight: container.scrollHeight,+ });++ const resultBlob: Blob | null = await new Promise<Blob | null>((resolve, reject) => {+ const timeout = setTimeout(() => {+ reject(new Error("Image generation timeout"));+ }, 45000); // 增加超时时间++ canvas.toBlob(+ (blob) => {+ clearTimeout(timeout);+ resolve(blob);+ },+ "image/png",+ 0.95+ );+ });+ // return generated blob; caller is responsible for uploading if needed+ return resultBlob;+ } finally {+ // 清理+ root.unmount();+ if (container.parentNode) {+ container.parentNode.removeChild(container);+ }+ }+}++/**+ * 等待容器内所有图片通过 proxy 加载完成+ */+function waitForImagesToLoad(container: HTMLElement, timeoutMs = 15000): Promise<void> {+ const imgs = Array.from(container.querySelectorAll('img')).map((img) => img as HTMLImageElement);+ if (imgs.length === 0) return Promise.resolve();++ return new Promise<void>((resolve) => {+ let settled = 0;+ const total = imgs.length;+ const onSettled = () => {+ settled++;+ if (settled >= total) resolve();+ };++ const timer = setTimeout(() => {+ resolve(); // 超时仍然继续,避免阻塞太久+ }, timeoutMs);++ imgs.forEach((img) => {+ // 使用单独的 Image 对象预加载,确保跨域资源也能尝试加载+ try {+ const tester = new Image();+ tester.crossOrigin = 'anonymous';+ tester.onload = () => {+ onSettled();+ };+ tester.onerror = () => {+ onSettled();+ };+ tester.src = img.src;+ } catch (e) {+ onSettled();+ }+ });+ });+}++export async function generateImageFromNode(node: HTMLElement, scale = 1): Promise<Blob | null> {+ try {+ // 确保节点在DOM中并且可见+ if (!node || !node.isConnected) {+ throw new Error("Node is not connected to DOM");+ }++ // 临时设置节点可见性用于截图+ const originalStyles = {+ position: node.style.position,+ left: node.style.left,+ top: node.style.top,+ visibility: node.style.visibility,+ };++ node.style.position = "fixed";+ node.style.left = "0";+ node.style.top = "0";+ node.style.visibility = "visible";++ const canvas = await html2canvas(node, {+ scale: Math.max(scale, 1), // 确保最小scale为1+ useCORS: true,+ allowTaint: false,+ backgroundColor: "#ffffff",+ logging: process.env.NODE_ENV === "development",+ scrollY: 0,+ scrollX: 0,+ width: node.offsetWidth,+ height: node.offsetHeight,+ windowWidth: node.offsetWidth,+ windowHeight: node.offsetHeight,+ // 提高图片质量+ imageTimeout: 10000, // 增加图片加载超时时间+ removeContainer: false,+ });++ // 恢复原始样式+ Object.assign(node.style, originalStyles);++ return new Promise<Blob | null>((resolve, reject) => {+ const timeout = setTimeout(() => {+ reject(new Error("Image generation timeout"));+ }, 30000); // 30秒超时++ canvas.toBlob(+ (blob) => {+ clearTimeout(timeout);+ if (!blob) {+ reject(new Error("Failed to generate blob from canvas"));+ return;+ }+ resolve(blob);+ },+ "image/png",+ 0.95 // 设置图片质量为95%+ );+ });++ } catch (error) {+ console.error("Error generating image from node:", error);+ throw error; // 重新抛出错误,让调用方处理+ }+}++/**+ * 将容器中所有img和video元素的AWS URL替换为代理URL+ */+function replaceMediaUrlsWithProxy(container: HTMLElement): void {+ const awsUrl = process.env.NEXT_PUBLIC_S3_URL!;+ const proxyUrl = process.env.NEXT_PUBLIC_S3_PROXY!;++ // 处理图片元素+ const images = container.querySelectorAll('img');++ images.forEach(img => {+ if (img.src && img.src.startsWith(awsUrl)) {+ const path = img.src.substring(awsUrl.length);+ img.src = proxyUrl + path;+ }+ });++ // 处理视频元素+ const videos = container.querySelectorAll('video');+ videos.forEach(video => {+ if (video.src && video.src.startsWith(awsUrl)) {+ const path = video.src.substring(awsUrl.length);+ video.src = proxyUrl + path;+ }++ // 也处理poster属性(视频封面图)+ if (video.poster && video.poster.startsWith(awsUrl)) {+ const path = video.poster.substring(awsUrl.length);+ video.poster = proxyUrl + path;+ }+ });+}++/**+ * 确保容器中的视频元素显示首帧+ */+async function ensureVideoThumbnails(container: HTMLElement): Promise<void> {+ const videos = container.querySelectorAll('video');++ if (videos.length === 0) {+ return;+ }++ const videoPromises = Array.from(videos).map(async (video) => {+ const videoElement = video as HTMLVideoElement;++ try {+ // 设置视频属性以确保能显示首帧+ videoElement.preload = 'metadata';+ videoElement.muted = true;+ videoElement.playsInline = true;++ // 如果视频已经有 poster,使用 poster+ if (videoElement.poster) {+ return;+ }++ // 等待视频元数据加载+ await new Promise<void>((resolve, reject) => {+ const timeout = setTimeout(() => {+ reject(new Error('Video metadata timeout'));+ }, 10000);++ videoElement.onloadedmetadata = () => {+ clearTimeout(timeout);+ resolve();+ };++ videoElement.onerror = () => {+ clearTimeout(timeout);+ reject(new Error('Video load error'));+ };++ // 如果视频已经加载了元数据+ if (videoElement.readyState >= 1) {+ clearTimeout(timeout);+ resolve();+ }+ });++ // 设置当前时间为0(首帧)+ videoElement.currentTime = 0;++ // 等待一帧渲染+ await new Promise<void>((resolve) => {+ const onSeeked = () => {+ videoElement.removeEventListener('seeked', onSeeked);+ setTimeout(resolve, 100); // 等待渲染+ };+ videoElement.addEventListener('seeked', onSeeked);+ });++ } catch (error) {+ console.warn('Failed to load video thumbnail:', error);+ // 如果视频加载失败,至少显示一个占位符+ replaceVideoWithPlaceholder(videoElement);+ }+ });++ try {+ await Promise.all(videoPromises);+ } catch (error) {+ console.warn('Some videos failed to load thumbnails:', error);+ }+}++/**+ * 用占位符替换无法加载的视频+ */+function replaceVideoWithPlaceholder(videoElement: HTMLVideoElement): void {+ const placeholder = document.createElement('div');+ placeholder.style.width = videoElement.offsetWidth + 'px';+ placeholder.style.height = videoElement.offsetHeight + 'px';+ placeholder.style.backgroundColor = '#f3f4f6';+ placeholder.style.border = '2px dashed #d1d5db';+ placeholder.style.borderRadius = '8px';+ placeholder.style.display = 'flex';+ placeholder.style.alignItems = 'center';+ placeholder.style.justifyContent = 'center';+ placeholder.style.color = '#6b7280';+ placeholder.style.fontSize = '14px';+ placeholder.style.fontFamily = 'Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial';++ const icon = document.createElement('div');+ icon.textContent = '🎥';+ icon.style.fontSize = '24px';+ icon.style.marginRight = '8px';++ const text = document.createElement('span');+ text.textContent = 'Video';++ placeholder.appendChild(icon);+ placeholder.appendChild(text);++ if (videoElement.parentNode) {+ videoElement.parentNode.replaceChild(placeholder, videoElement);+ }+}++/**+ * 规范化媒体容器样式,避免在截图时出现气泡颜色变淡的问题+ */+function normalizeMediaWrapperStyles(container: HTMLElement): void {+ // 将使用 bg-muted 的按钮背景替换为与消息气泡一致的背景(bg-card)+ const mediaButtons = container.querySelectorAll('button');+ mediaButtons.forEach(btn => {+ // 仅处理包含 video 或 img 的按钮+ if (btn.querySelector('video') || btn.querySelector('img')) {+ // 强制设置背景与边框,覆盖 Tailwind 的语义化类带来的颜色差异+ (btn as HTMLElement).style.background = '#ffffff';+ (btn as HTMLElement).style.borderColor = '#e6e9ef';+ (btn as HTMLElement).style.boxShadow = 'none';+ (btn as HTMLElement).style.opacity = '1';+ }+ });++ // 对直接包含媒体的容器也做同样处理(例如 markdown 渲染出来的 video 包裹)+ const mediaWrappers = container.querySelectorAll('.bg-muted, .media-wrapper');+ mediaWrappers.forEach(w => {+ (w as HTMLElement).style.background = '#ffffff';+ (w as HTMLElement).style.opacity = '1';+ });+}++/**+ * 将 AI 消息气泡调暗一些,截图时视觉更贴合设计要求+ */+function dimAssistantBubbles(container: HTMLElement): void {+ try {+ // Find avatar images that are the assistant logo (AiToEarn)+ const imgs = Array.from(container.querySelectorAll('img'));+ imgs.forEach((img) => {+ try {+ const src = img.src || '';+ // heuristic: logo file name contains 'logo' or 'aitoearn'+ if (!/logo|aitoearn/i.test(src)) return;++ // find the message root (the flex container that holds avatar + message)+ let root = img.closest('.flex');+ if (!root) {+ // fallback: go up a few levels to find a container with two children (avatar + content)+ let el: HTMLElement | null = img.parentElement;+ for (let i = 0; i < 4 && el; i++) {+ if (el.classList && el.classList.contains('flex')) {+ root = el;+ break;+ }+ el = el.parentElement;+ }+ }+ if (!root) return;++ // within the root, find descendant that looks like the message bubble (bg-card)+ const bubble = root.querySelector('.bg-card') as HTMLElement | null;+ if (!bubble) return;++ // Apply stronger background and text color to increase contrast for exported image+ bubble.style.background = '#ffffff'; // keep white base+ bubble.style.boxShadow = 'inset 0 0 0 1px rgba(0,0,0,0.03)';+ bubble.style.color = '#0f172a';+ bubble.style.opacity = '1';+ // Also ensure any muted-text inside becomes more visible+ const mutedEls = bubble.querySelectorAll('.text-muted-foreground, .text-muted');+ mutedEls.forEach((el) => {+ (el as HTMLElement).style.color = '#4b5563'; // slate-600+ (el as HTMLElement).style.opacity = '1';+ });+ } catch (e) {+ // ignore per-element errors+ }+ });+ } catch (e) {+ // silent+ }+}++diff --git a/project/web/src/components/ui/button.tsx b/project/web/src/components/ui/button.tsxindex 7ce9a0c3..c1b78b32 100644--- a/project/web/src/components/ui/button.tsx+++ b/project/web/src/components/ui/button.tsx@@ -38,20 +38,49 @@ export interface ButtonPropsextends React.ButtonHTMLAttributes<HTMLButtonElement>,VariantProps<typeof buttonVariants> {asChild?: boolean+ loading?: boolean}const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(- ({ className, variant, size, asChild = false, ...props }, ref) => {- const Comp = asChild ? Slot : "button"+ ({ className, variant, size, asChild = false, loading, ...props }, ref) => {+ const Comp = asChild ? Slot : "button";+ const isDisabled = props.disabled || loading;return (<CompclassName={cn(buttonVariants({ variant, size, className }))}ref={ref}+ disabled={isDisabled}{...props}- />- )+ >+ {loading && (+ <svg+ className="w-4 h-4 mr-2 animate-spin"+ viewBox="0 0 24 24"+ aria-hidden+ >+ <circle+ cx="12"+ cy="12"+ r="10"+ stroke="currentColor"+ strokeWidth="4"+ strokeOpacity="0.2"+ fill="none"+ />+ <path+ d="M22 12a10 10 0 0 1-10 10"+ stroke="currentColor"+ strokeWidth="4"+ strokeLinecap="round"+ fill="none"+ />+ </svg>+ )}+ {props.children}+ </Comp>+ );}-)+);Button.displayName = "Button"export { Button, buttonVariants }diff --git a/project/web/src/components/ui/dialog.tsx b/project/web/src/components/ui/dialog.tsxindex 267bcc59..562254e9 100644--- a/project/web/src/components/ui/dialog.tsx+++ b/project/web/src/components/ui/dialog.tsx@@ -17,16 +17,29 @@ const DialogClose = DialogPrimitive.Closeconst DialogOverlay = React.forwardRef<React.ElementRef<typeof DialogPrimitive.Overlay>,React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>->(({ className, ...props }, ref) => (- <DialogPrimitive.Overlay- ref={ref}- className={cn(- "fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-500",- className- )}- {...props}- />-))+>(({ className, ...props }, ref) => {+ // prevent clicks on the overlay from bubbling to underlying elements (which may cause navigation)+ const handlePointerDown: React.PointerEventHandler = (e) => {+ e.stopPropagation();+ if (typeof props.onPointerDown === "function") {+ try {+ (props.onPointerDown as any)(e);+ } catch {}+ }+ };++ return (+ <DialogPrimitive.Overlay+ ref={ref}+ className={cn(+ "fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-500",+ className+ )}+ onPointerDown={handlePointerDown}+ {...props}+ />+ );+})DialogOverlay.displayName = DialogPrimitive.Overlay.displayNameinterface DialogContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {diff --git a/project/web/src/components/ui/modal.tsx b/project/web/src/components/ui/modal.tsxindex 25bf865a..df39815b 100644--- a/project/web/src/components/ui/modal.tsx+++ b/project/web/src/components/ui/modal.tsx@@ -101,11 +101,11 @@ export const Modal: React.FC<ModalProps> = ({// 默认 footerconst defaultFooter = (<>- <Button variant="outline" onClick={onCancel} disabled={confirmLoading}>+ <Button variant="outline" onClick={onCancel}>{cancelText}</Button>- <Button onClick={onOk} disabled={confirmLoading}>- {confirmLoading ? '处理中...' : okText}+ <Button onClick={onOk} disabled={confirmLoading} loading={confirmLoading}>+ {okText}</Button></>)diff --git a/project/web/src/constant.ts b/project/web/src/constant.tsindex 886ff4f6..3f062737 100644--- a/project/web/src/constant.ts+++ b/project/web/src/constant.ts@@ -6,6 +6,7 @@ export const ProxyUrls = ['/api/',process.env.NEXT_PUBLIC_BILI_OSS_PROXY,process.env.NEXT_PUBLIC_OSS_URL_PROXY,+ process.env.NEXT_PUBLIC_S3_PROXY,]// OSS URL