Skip to content

Let's use AI to Earn!

refactor(web): AI Features Enhancement & Multi-language Support (#282)

布莱恩·奥夫托·杰森张a2ac2d17220d
diff --git a/project/web/@types/resources.d.ts b/project/web/@types/resources.d.ts
index 858b1678..9bc5cd63 100644
--- a/project/web/@types/resources.d.ts
+++ b/project/web/@types/resources.d.ts
@@ -1782,7 +1782,7 @@ interface Resources {
"type": "图片生成",
"duration": "",
"resolution": "",
- "notes": "又名nano banana,支持多图像输入",
+ "notes": "又名Nano Banana Pro,支持多图像输入",
"credits": "1",
"price": "0.27元",
"channel": "yun"
@@ -2222,7 +2222,7 @@ interface Resources {
"congratulations": "恭喜您获得3天免费会员体验!",
"description": "作为新用户,您可以享受7天的免费会员权益,体验所有高级功能,包括:",
"unlimitedAI": "✓ Sora-2:免费且无限",
- "priorityProcessing": "✓ Nano Banana:免费且无限",
+ "priorityProcessing": "✓ Nano Banana Pro:免费且无限",
"advancedModels": "✓ 历史内容导入",
"dedicatedSupport": "✓ 免费计划的所有功能",
"noAds": "✓ 无广告体验",
@@ -2775,7 +2775,7 @@ interface Resources {
"dailyPoints": "发布:抖音、小红书、视频号、快手、哔哩哔哩、微信公众号、TikTok、YouTube、Facebook、Instagram、Threads、X (Twitter)、Pinterest",
"maxPoints": "互动:抖音、小红书、Facebook、Instagram、Threads",
"videos": "AI工具:核心模型池(gpt-5系列、gemini-2.5-pro/flash、qwen-vl-max、gpt-image-1、FLUX.1 Kontext、seedream/seededit、md2card、萤火卡等)",
- "images": "Sora-2 & Nano Banana: 有限使用(按积分/限额)",
+ "images": "Sora-2 & Nano Banana Pro: 有限使用(按积分/限额)",
"storage": "内容和评论搜索、智能互动"
}
},
@@ -2792,7 +2792,7 @@ interface Resources {
"description": "每月最多150+次视频生成",
"features": {
"contentReview": "Sora-2:免费且无限",
- "dailyPoints": "Nano Banana:免费且无限",
+ "dailyPoints": "Nano Banana Pro:免费且无限",
"multiModel": "历史内容导入",
"textToVideo": "免费计划的所有功能",
"aiGeneration": "无限频道连接",
diff --git a/project/web/src/app/[lng]/material/ai-generate/page.tsx b/project/web/src/app/[lng]/material/ai-generate/page.tsx
index cb932a8e..a7b91583 100644
--- a/project/web/src/app/[lng]/material/ai-generate/page.tsx
+++ b/project/web/src/app/[lng]/material/ai-generate/page.tsx
@@ -2,6 +2,7 @@
import { ArrowLeftOutlined, DownloadOutlined, FileTextOutlined, FireOutlined, MessageOutlined, PictureOutlined, RobotOutlined, UploadOutlined, VideoCameraOutlined } from '@ant-design/icons'
import { Button, Col, Input, message, Modal, Progress, Row, Select } from 'antd'
+import Image from 'next/image'
import { useParams, useRouter, useSearchParams } from 'next/navigation'
import { useEffect, useMemo, useRef, useState } from 'react'
import { editImage, generateFireflyCard, generateImage, generateMd2Card, generateVideo, getImageEditModels, getImageEditTaskStatus, getImageGenerationModels, getImageTaskStatus, getVideoGenerationModels, getVideoGenerations, getVideoTaskStatus } from '@/api/ai'
@@ -1218,8 +1219,12 @@ export default function AIGeneratePage() {
<div className={styles.subTabLabel}>{t('aiGenerate.markdownToCard')}</div>
</button>
<button className={`${styles.subTab} ${activeImageTab === 'chat' ? styles.subTabActive : ''}`} onClick={() => setActiveImageTab('chat')}>
- <div className="subTabIcon"><MessageOutlined /></div>
- <div className={styles.subTabLabel}>Nano Banana</div>
+ <div className="subTabIcon" style={{ position: 'relative' }}>
+ <span style={{ color: '#a66ae4', fontSize: '10px', fontWeight: 'bold', padding: '0 5px', fontStyle: 'italic', position: 'absolute', top: 2, left: -38 }}>
+ NEW
+ </span>
+ <MessageOutlined /></div>
+ <div className={styles.subTabLabel}>Nano Banana Pro</div>
</button>
</div>
)}
@@ -1251,7 +1256,18 @@ export default function AIGeneratePage() {
<div className={styles.blockTitle} style={{ marginTop: 12 }}>{t('aiGenerate.selectModelPlaceholder')}</div>
<div className={styles.modelSelect}>
<button className={styles.modelSelectBtn} onClick={() => setShowModelDropdown(s => !s)}>
- <div className={styles.modelIconSelect}><PictureOutlined style={{ fontSize: '24px' }} /></div>
+ <div className={styles.modelIconSelect}>
+ {(() => {
+ const m: any = imageModels.find((x: any) => x.name === model)
+ return m?.logo
+ ? (
+ <Image src={m.logo} alt={m.name} width={24} height={24} style={{ borderRadius: 4, objectFit: 'cover' }} />
+ )
+ : (
+ <PictureOutlined style={{ fontSize: '24px' }} />
+ )
+ })()}
+ </div>
<div className={styles.modelMain}>
<div className={styles.modelHeader}>
<span className={styles.modelName}>{model || t('aiGenerate.selectModelPlaceholder')}</span>
@@ -1284,7 +1300,15 @@ export default function AIGeneratePage() {
<div className={styles.modelMain}>
<div className={styles.modelHeader}>
- <div className={styles.modelIcon}><PictureOutlined /></div>
+ <div className={styles.modelIcon}>
+ {m?.logo
+ ? (
+ <Image src={m.logo} alt={m.name} width={20} height={20} style={{ borderRadius: 4, objectFit: 'cover' }} />
+ )
+ : (
+ <PictureOutlined />
+ )}
+ </div>
<span className={styles.modelName}>{m.name || ''}</span>
{m.mainTag ? <span className={styles.modelTag}>New</span> : null}
</div>
@@ -1846,7 +1870,18 @@ export default function AIGeneratePage() {
<div className={styles.blockTitle} style={{ marginTop: 12 }}>{t('aiGenerate.selectModelPlaceholder')}</div>
<div className={styles.modelSelect}>
<button className={styles.modelSelectBtn} onClick={() => setShowVideoModelDropdown(s => !s)}>
- <div className={styles.modelIconSelect}><VideoCameraOutlined style={{ fontSize: '24px' }} /></div>
+ <div className={styles.modelIconSelect}>
+ {(() => {
+ const m: any = (filteredVideoModels as any[]).find((x: any) => x.name === videoModel)
+ return m?.logo
+ ? (
+ <Image src={m.logo} alt={m.name} width={24} height={24} style={{ borderRadius: 4, objectFit: 'cover' }} />
+ )
+ : (
+ <VideoCameraOutlined style={{ fontSize: '24px' }} />
+ )
+ })()}
+ </div>
<div className={styles.modelMain}>
<div className={styles.modelHeader}>
<span className={styles.modelName}>{videoModel || t('aiGenerate.selectModelPlaceholder')}</span>
@@ -1879,7 +1914,15 @@ export default function AIGeneratePage() {
<div className={styles.modelMain}>
<div className={styles.modelHeader}>
- <div className={styles.modelIcon}><VideoCameraOutlined /></div>
+ <div className={styles.modelIcon}>
+ {m?.logo
+ ? (
+ <Image src={m.logo} alt={m.name} width={20} height={20} style={{ borderRadius: 4, objectFit: 'cover' }} />
+ )
+ : (
+ <VideoCameraOutlined />
+ )}
+ </div>
<span className={styles.modelName}>{m.name || ''}</span>
{m.mainTag || m.name.includes('sora') ? <span className={styles.modelTag}>New</span> : null}
</div>
diff --git a/project/web/src/app/[lng]/page.tsx b/project/web/src/app/[lng]/page.tsx
index 0a6d3fdf..b724d76f 100644
--- a/project/web/src/app/[lng]/page.tsx
+++ b/project/web/src/app/[lng]/page.tsx
@@ -60,7 +60,13 @@ function ReleaseBanner() {
}}
>
{/* <span className={styles.releaseTag}>{t('releaseBanner.tag')}</span> */}
- <span className={styles.releaseText}>Join Plus — Enjoy Unlimited Free Sora-2, Nano Banana!</span>
+ <span className={styles.releaseText}>Join Plus —
+
+ Enjoy Unlimited Free Sora-2,
+ <span style={{ color: '#FFD700', fontSize: '14px', fontWeight: 'bold', padding: '0 5px', fontStyle: 'italic' }}>
+ NEW
+ </span>
+ Nano Banana Pro !</span>
{/* <svg className={styles.arrowIcon} width="16" height="16" viewBox="0 0 16 16" fill="none">
<path d="m6 12 4-4-4-4" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
</svg> */}
diff --git a/project/web/src/app/[lng]/pricing/page.tsx b/project/web/src/app/[lng]/pricing/page.tsx
index b191a8b2..07bda1da 100644
--- a/project/web/src/app/[lng]/pricing/page.tsx
+++ b/project/web/src/app/[lng]/pricing/page.tsx
@@ -160,7 +160,7 @@ export default function PricingPage() {
type: '图片生成',
duration: '',
resolution: '',
- notes: '又名nano banana,支持多图像输入',
+ notes: '又名Nano Banana Pro,支持多图像输入',
credits: '1',
price: '0.27',
channel: 'yun',
diff --git a/project/web/src/app/[lng]/profile/page.tsx b/project/web/src/app/[lng]/profile/page.tsx
index cf02d027..0e173db0 100644
--- a/project/web/src/app/[lng]/profile/page.tsx
+++ b/project/web/src/app/[lng]/profile/page.tsx
@@ -701,7 +701,12 @@ export default function ProfilePage() {
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: 10, overflow: 'hidden', flex: 1 }}>
- <div style={{ width: 28, height: 28, borderRadius: 6, background: '#F3F4F6', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#6B7280', fontSize: 14 }}>AI</div>
+ {
+ (() => {
+ const m: any = (chatModels || []).find((x: any) => x.name === defaultModel)
+ return m?.logo ? <Image src={m?.logo} alt={m?.name} width={28} height={28} className={styles.modelLogo} /> : <div style={{ width: 28, height: 28, borderRadius: 6, background: '#F3F4F6', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#6B7280', fontSize: 14 }}>AI</div>
+ })()
+ }
<div style={{ display: 'flex', flexDirection: 'column', gap: 2, minWidth: 0 }}>
<div style={{ fontWeight: 600, color: '#111827', fontSize: 14, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
{(() => {
@@ -739,13 +744,16 @@ export default function ProfilePage() {
background: isActive ? '#F3E8FF' : 'transparent',
}}
>
- <div style={{ width: 28, height: 28, borderRadius: 6, background: '#F3F4F6', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#6B7280', fontSize: 14 }}>AI</div>
+ {
+ m?.logo ? <Image src={m?.logo} alt={m?.name} width={28} height={28} className={styles.modelLogo} /> :
+ <div style={{ width: 28, height: 28, borderRadius: 6, background: '#F3F4F6', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#6B7280', fontSize: 14 }}>AI</div>
+ }
<div style={{ display: 'flex', flexDirection: 'column', gap: 4, flex: 1, minWidth: 0 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
- <span style={{ fontWeight: 600, color: '#111827', fontSize: 14 }}>{m.name || ''}</span>
+ <span style={{ fontWeight: 600, color: '#111827', fontSize: 14 }}>{m.description || ''}</span>
{m?.mainTag ? <span style={{ fontSize: 10, background: '#EDE9FE', color: '#7C3AED', padding: '2px 6px', borderRadius: 10 }}>New</span> : null}
</div>
- <div style={{ color: '#6B7280', fontSize: 12 }}>{m.description || ''}</div>
+ {/* <div style={{ color: '#6B7280', fontSize: 12 }}>{m.description || ''}</div> */}
<div style={{ display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' }}>
{(m?.tags || []).map((tag: string) => (
<span key={tag} style={{ fontSize: 10, background: '#F3F4F6', color: '#6B7280', padding: '2px 6px', borderRadius: 10 }}>{tag}</span>
@@ -755,10 +763,9 @@ export default function ProfilePage() {
? (
<div style={{ color: '#374151', fontSize: 12, marginTop: 0 }}>
<span>
- prompt
- {m.pricing.prompt}
+ input { ' '+m.pricing.prompt}
</span>
- {m.pricing.completion ? <span>{` · completion ${m.pricing.completion}`}</span> : null}
+ {m.pricing.completion ? <span>{` · output ${m.pricing.completion}`}</span> : null}
</div>
)
: null}
diff --git a/project/web/src/app/[lng]/profile/profile.module.css b/project/web/src/app/[lng]/profile/profile.module.css
index 8c253f5e..0ef55b7a 100644
--- a/project/web/src/app/[lng]/profile/profile.module.css
+++ b/project/web/src/app/[lng]/profile/profile.module.css
@@ -1275,3 +1275,11 @@
background-color: #e2e8f0;
color: #8b5cf6;
}
+
+/* Model logo 样式 */
+.modelLogo {
+ width: 28px;
+ height: 28px;
+ border-radius: 6px;
+ object-fit: cover;
+}
\ No newline at end of file
diff --git a/project/web/src/app/i18n/locales/en/pricing.json b/project/web/src/app/i18n/locales/en/pricing.json
index 039b7df9..d4feb2c0 100644
--- a/project/web/src/app/i18n/locales/en/pricing.json
+++ b/project/web/src/app/i18n/locales/en/pricing.json
@@ -144,7 +144,7 @@
"type": "Image Generation",
"duration": "",
"resolution": "",
- "notes": "Also known as nano banana, supports multi-image input",
+ "notes": "Also known as Nano Banana Pro, supports multi-image input",
"credits": "1 credit",
"price": "¥0.27",
"channel": "yun"
diff --git a/project/web/src/app/i18n/locales/en/profile.json b/project/web/src/app/i18n/locales/en/profile.json
index 559dac55..352e1160 100644
--- a/project/web/src/app/i18n/locales/en/profile.json
+++ b/project/web/src/app/i18n/locales/en/profile.json
@@ -148,7 +148,7 @@
"congratulations": "Congratulations! You've earned a 3-day free member trial!",
"description": "As a new user, you can enjoy 3 days of free member benefits and experience all premium features, including:",
"unlimitedAI": "✓ Sora-2: Free & Unlimited",
- "priorityProcessing": "✓ Nano Banana: Free & Unlimited",
+ "priorityProcessing": "✓ Nano Banana Pro: Free & Unlimited",
"advancedModels": "✓ Historical Content Import",
"dedicatedSupport": "✓ Everything in Free",
"noAds": "✓ Ad-Free Experience",
diff --git a/project/web/src/app/i18n/locales/en/publish.json b/project/web/src/app/i18n/locales/en/publish.json
index e32e647c..37a1d75b 100644
--- a/project/web/src/app/i18n/locales/en/publish.json
+++ b/project/web/src/app/i18n/locales/en/publish.json
@@ -4,6 +4,12 @@
"title": "Confirm Close",
"content": "After closing, the filled content will be saved. You can restore it next time you open it. Do you confirm that it has been closed?"
},
+ "restoreData": {
+ "title": "Reminder",
+ "content": "The system detected that you have an unfinished publish record. Do you want to restore it?",
+ "okText": "Restore",
+ "cancelText": "Discard"
+ },
"buttons": {
"customizePerAccount": "Customize per account",
"cancelPublish": "Cancel Publish",
@@ -133,7 +139,14 @@
"videoModelLoadTimeout": "Video model load timeout, please retry",
"videoProcessingFailed": "Video processing failed, please retry",
"imageProcessingFailed": "Image {{index}} processing failed: {{error}}",
- "videoReady": "✅ Video ready!"
+ "videoReady": "✅ Video ready!",
+ "customPrompts": {
+ "title": "Custom Prompts",
+ "description": "Configure custom prompts for each feature. Leave empty to use default behavior (no additional prompts).",
+ "placeholder": "Leave empty to use default",
+ "clearAll": "Clear All Custom Prompts",
+ "clearSuccess": "All custom prompts cleared"
+ }
},
"upload": {
"finishingUp": "Finishing up...",
diff --git a/project/web/src/app/i18n/locales/en/vip.json b/project/web/src/app/i18n/locales/en/vip.json
index c5b8045d..919293ab 100644
--- a/project/web/src/app/i18n/locales/en/vip.json
+++ b/project/web/src/app/i18n/locales/en/vip.json
@@ -118,7 +118,7 @@
"dailyPoints": "✓ Publishing: Douyin, Xiaohongshu (Rednote), WeChat Channels, Kuaishou, Bilibili, WeChat Official Accounts, TikTok, YouTube, Facebook, Instagram, Threads, X (Twitter), Pinterest",
"maxPoints": "✓ Engage: Douyin, Xiaohongshu (Rednote), Facebook, Instagram, Threads",
"videos": "✓ AI Access: Core model pool (gpt-5 family, gemini-2.5-pro/flash, qwen-vl-max, gpt-image-1, FLUX.1 Kontext, seedream/seededit, md2card, firefly card, etc.)",
- "images": "✓ Sora-2 & Nano Banana: Limited usage (credit-based / capped)",
+ "images": "✓ Sora-2 & Nano Banana Pro: Limited usage (credit-based / capped)",
"storage": "✓ Content & comment search, smart engage"
}
},
@@ -135,7 +135,7 @@
"description": "Up to 150+ video gens/month",
"features": {
"contentReview": "✓ Sora-2: Free & Unlimited ",
- "dailyPoints": "Nano Banana: Free & Unlimited ",
+ "dailyPoints": "Nano Banana Pro: Free & Unlimited ",
"multiModel": "✓ Historical Content Import",
"textToVideo": "✓ Everything in Free",
"aiGeneration": "✓ Unlimited channel links",
diff --git a/project/web/src/app/i18n/locales/zh-CN/pricing.json b/project/web/src/app/i18n/locales/zh-CN/pricing.json
index 9a501b19..b855dfbe 100644
--- a/project/web/src/app/i18n/locales/zh-CN/pricing.json
+++ b/project/web/src/app/i18n/locales/zh-CN/pricing.json
@@ -143,7 +143,7 @@
"type": "图片生成",
"duration": "",
"resolution": "",
- "notes": "又名nano banana,支持多图像输入",
+ "notes": "又名Nano Banana Pro,支持多图像输入",
"credits": "1",
"price": "0.27元",
"channel": "yun"
diff --git a/project/web/src/app/i18n/locales/zh-CN/profile.json b/project/web/src/app/i18n/locales/zh-CN/profile.json
index 83e629d6..1cb7eb65 100644
--- a/project/web/src/app/i18n/locales/zh-CN/profile.json
+++ b/project/web/src/app/i18n/locales/zh-CN/profile.json
@@ -149,7 +149,7 @@
"congratulations": "恭喜您获得3天免费会员体验!",
"description": "作为新用户,您可以享受7天的免费会员权益,体验所有高级功能,包括:",
"unlimitedAI": "✓ Sora-2:免费且无限",
- "priorityProcessing": "✓ Nano Banana:免费且无限",
+ "priorityProcessing": "✓ Nano Banana Pro:免费且无限",
"advancedModels": "✓ 历史内容导入",
"dedicatedSupport": "✓ 免费计划的所有功能",
"noAds": "✓ 无广告体验",
diff --git a/project/web/src/app/i18n/locales/zh-CN/publish.json b/project/web/src/app/i18n/locales/zh-CN/publish.json
index 3ec5feb7..fc8263e7 100644
--- a/project/web/src/app/i18n/locales/zh-CN/publish.json
+++ b/project/web/src/app/i18n/locales/zh-CN/publish.json
@@ -4,6 +4,12 @@
"title": "确认关闭",
"content": "关闭后,已填写的内容将被保存,您下次打开可以恢复,是否确认关闭?"
},
+ "restoreData": {
+ "title": "温馨提示",
+ "content": "系统检测到您有未完成的发布记录,是否要恢复?",
+ "okText": "恢复",
+ "cancelText": "不恢复"
+ },
"buttons": {
"customizePerAccount": "自定义每个账户",
"cancelPublish": "取消发布",
@@ -134,7 +140,14 @@
"videoModelLoadTimeout": "视频模型加载超时,请稍后重试",
"videoProcessingFailed": "视频处理失败,请重试",
"imageProcessingFailed": "图片 {{index}} 处理失败: {{error}}",
- "videoReady": "✅ 视频生成完成!"
+ "videoReady": "✅ 视频生成完成!",
+ "customPrompts": {
+ "title": "自定义提示词",
+ "description": "为每个功能配置自定义提示词。留空则使用默认行为(不添加额外提示词)。",
+ "placeholder": "留空使用默认行为",
+ "clearAll": "清空所有自定义提示词",
+ "clearSuccess": "已清空所有自定义提示词"
+ }
},
"upload": {
"finishingUp": "正在完成...",
diff --git a/project/web/src/app/i18n/locales/zh-CN/vip.json b/project/web/src/app/i18n/locales/zh-CN/vip.json
index 0ff5d350..830421c7 100644
--- a/project/web/src/app/i18n/locales/zh-CN/vip.json
+++ b/project/web/src/app/i18n/locales/zh-CN/vip.json
@@ -118,7 +118,7 @@
"dailyPoints": "发布:抖音、小红书、视频号、快手、哔哩哔哩、微信公众号、TikTok、YouTube、Facebook、Instagram、Threads、X (Twitter)、Pinterest",
"maxPoints": "互动:抖音、小红书、Facebook、Instagram、Threads",
"videos": "AI工具:核心模型池(gpt-5系列、gemini-2.5-pro/flash、qwen-vl-max、gpt-image-1、FLUX.1 Kontext、seedream/seededit、md2card、萤火卡等)",
- "images": "Sora-2 & Nano Banana: 有限使用(按积分/限额)",
+ "images": "Sora-2 & Nano Banana Pro: 有限使用(按积分/限额)",
"storage": "内容和评论搜索、智能互动"
}
},
@@ -135,7 +135,7 @@
"description": "每月最多150+次视频生成",
"features": {
"contentReview": "Sora-2:免费且无限",
- "dailyPoints": "Nano Banana:免费且无限",
+ "dailyPoints": "Nano Banana Pro:免费且无限",
"multiModel": "历史内容导入",
"textToVideo": "免费计划的所有功能",
"aiGeneration": "无限频道连接",
diff --git a/project/web/src/app/layout/LyaoutHeader.tsx b/project/web/src/app/layout/LyaoutHeader.tsx
index 347acb09..475eaea9 100644
--- a/project/web/src/app/layout/LyaoutHeader.tsx
+++ b/project/web/src/app/layout/LyaoutHeader.tsx
@@ -302,7 +302,13 @@ const LyaoutHeader = memo(
<div className={styles.bannerContent} onClick={() => setVipModalVisible(true)}>
{' '}
{/* 点击横幅打开VIP弹窗,而不是跳转 */}
- <span className={styles.releaseText}>Join Plus — Enjoy Unlimited Free Sora-2, Nano Banana!</span>
+ <span className={styles.releaseText}>Join Plus —
+ Enjoy Unlimited Free Sora-2,
+ <span style={{ color: '#FFD700', fontSize: '14px', fontWeight: 'bold', padding: '0 5px', fontStyle: 'italic' }}>
+ NEW
+ </span>
+ Nano Banana Pro !
+ </span>
</div>
<button
className={styles.closeButton}
diff --git a/project/web/src/components/PublishDialog/compoents/PublishDialogAi.tsx b/project/web/src/components/PublishDialog/compoents/PublishDialogAi.tsx
index 23f33e29..47bdb0ad 100644
--- a/project/web/src/components/PublishDialog/compoents/PublishDialogAi.tsx
+++ b/project/web/src/components/PublishDialog/compoents/PublishDialogAi.tsx
@@ -310,13 +310,10 @@ const PublishDialogAi = memo(
const [activeAction, setActiveAction] = useState<AIAction | null>(null)
const [messages, setMessages] = useState<Message[]>([])
const [inputValue, setInputValue] = useState('')
- const [customPrompts, setCustomPrompts] = useState<Record<string, string>>({
- expand: t('aiFeatures.defaultPrompts.expand' as any),
- polish: t('aiFeatures.defaultPrompts.polish' as any),
- translate: t('aiFeatures.defaultPrompts.translate' as any),
- generateImage: t('aiFeatures.defaultPrompts.generateImage' as any),
- generateVideo: t('aiFeatures.defaultPrompts.generateVideo' as any),
- generateHashtags: t('aiFeatures.defaultPrompts.generateHashtags' as any),
+ // Load custom prompts from localStorage
+ const [customPrompts, setCustomPrompts] = useState<Record<string, string>>(() => {
+ const saved = localStorage.getItem('ai_custom_prompts')
+ return saved ? JSON.parse(saved) : {}
})
const [isProcessing, setIsProcessing] = useState(false)
const [settingsVisible, setSettingsVisible] = useState(false)
@@ -754,26 +751,26 @@ const PublishDialogAi = memo(
let systemPrompt = ''
- // Generate prompt based on selected action
+ // Generate default system prompt based on selected action
if (currentAction) {
switch (currentAction) {
case 'shorten':
systemPrompt = t('aiFeatures.defaultPrompts.shorten' as any)
break
case 'expand':
- systemPrompt = customPrompts.expand || t('aiFeatures.defaultPrompts.expand' as any)
+ systemPrompt = t('aiFeatures.defaultPrompts.expand' as any)
break
case 'polish':
- systemPrompt = customPrompts.polish || t('aiFeatures.defaultPrompts.polish' as any)
+ systemPrompt = t('aiFeatures.defaultPrompts.polish' as any)
break
case 'translate':
- systemPrompt = customPrompts.translate || t('aiFeatures.defaultPrompts.translate' as any)
+ systemPrompt = t('aiFeatures.defaultPrompts.translate' as any)
break
case 'generateImage':
- systemPrompt = customPrompts.generateImage || t('aiFeatures.defaultPrompts.generateImage' as any)
+ systemPrompt = t('aiFeatures.defaultPrompts.generateImage' as any)
break
case 'generateHashtags':
- systemPrompt = customPrompts.generateHashtags || t('aiFeatures.defaultPrompts.generateHashtags' as any)
+ systemPrompt = t('aiFeatures.defaultPrompts.generateHashtags' as any)
break
}
}
@@ -781,13 +778,17 @@ const PublishDialogAi = memo(
// Prepare API messages
const apiMessages: Array<{ role: string, content: string }> = []
-
-
- // Only add system prompt if exists
+ // Add default system prompt if exists
if (systemPrompt) {
apiMessages.push({ role: 'system', content: systemPrompt })
}
+ // Add user custom system prompt if configured
+ const userCustomPrompt = currentAction ? (customPrompts[currentAction] || '') : ''
+ if (userCustomPrompt) {
+ apiMessages.push({ role: 'system', content: userCustomPrompt })
+ }
+
apiMessages.push({ role: 'user', content: messageContent })
// Call AI interface
@@ -1195,6 +1196,7 @@ const PublishDialogAi = memo(
{t('aiFeatures.close' as any)}
</Button>,
]}
+ width={700}
>
{/* Chat model selection */}
<div style={{ marginBottom: 16 }}>
@@ -1217,13 +1219,13 @@ const PublishDialogAi = memo(
<Option
key={model.name}
value={model.name}
- label={model.name}
+ label={model.description || model.name}
>
<div style={{ padding: '4px 0' }}>
- <div style={{ fontWeight: 'bold', marginBottom: '4px' }}>{model.name}</div>
+ <div style={{ fontWeight: 'bold', marginBottom: '4px' }}>{model.description}</div>
{model.description && (
<div style={{ fontSize: '12px', color: '#999', whiteSpace: 'normal', lineHeight: '1.4' }}>
- {model.description}
+ {model.name}
</div>
)}
</div>
@@ -1253,13 +1255,13 @@ const PublishDialogAi = memo(
<Option
key={model.name}
value={model.name}
- label={model.name}
+ label={model.description || model.name}
>
<div style={{ padding: '4px 0' }}>
- <div style={{ fontWeight: 'bold', marginBottom: '4px' }}>{model.name}</div>
+ <div style={{ fontWeight: 'bold', marginBottom: '4px' }}>{model.description}</div>
{model.description && (
<div style={{ fontSize: '12px', color: '#999', whiteSpace: 'normal', lineHeight: '1.4' }}>
- {model.description}
+ {model.name}
</div>
)}
</div>
@@ -1289,13 +1291,13 @@ const PublishDialogAi = memo(
<Option
key={model.name}
value={model.name}
- label={model.name}
+ label={model.description || model.name}
>
<div style={{ padding: '4px 0' }}>
- <div style={{ fontWeight: 'bold', marginBottom: '4px' }}>{model.name}</div>
+ <div style={{ fontWeight: 'bold', marginBottom: '4px' }}>{model.description}</div>
{model.description && (
<div style={{ fontSize: '12px', color: '#999', whiteSpace: 'normal', lineHeight: '1.4' }}>
- {model.description}
+ {model.name}
</div>
)}
</div>
@@ -1327,6 +1329,176 @@ const PublishDialogAi = memo(
)
})()}
</div>
+
+ {/* Custom prompts editor */}
+ <div style={{ marginTop: 24, borderTop: '1px solid #e8e8e8', paddingTop: 16 }}>
+ <Collapse
+ items={[
+ {
+ key: '1',
+ label: (
+ <div style={{ fontWeight: 'bold' }}>
+ <EditOutlined style={{ marginRight: 8 }} />
+ {t('aiFeatures.customPrompts.title' as any)}
+ </div>
+ ),
+ children: (
+ <div>
+ <div style={{ marginBottom: 12, fontSize: '12px', color: '#666' }}>
+ {t('aiFeatures.customPrompts.description' as any)}
+ </div>
+
+ {/* Shorten */}
+ <div style={{ marginBottom: 16 }}>
+ <div style={{ marginBottom: 4, fontWeight: 500, fontSize: '13px' }}>
+ <CompressOutlined style={{ marginRight: 4 }} />
+ {t('aiFeatures.shorten' as any)}
+ </div>
+ <Input.TextArea
+ value={customPrompts.shorten || ''}
+ onChange={(e) => {
+ const newPrompts = { ...customPrompts, shorten: e.target.value }
+ setCustomPrompts(newPrompts)
+ localStorage.setItem('ai_custom_prompts', JSON.stringify(newPrompts))
+ }}
+ placeholder={t('aiFeatures.customPrompts.placeholder' as any)}
+ rows={2}
+ style={{ fontSize: '12px' }}
+ />
+ </div>
+
+ {/* Expand */}
+ <div style={{ marginBottom: 16 }}>
+ <div style={{ marginBottom: 4, fontWeight: 500, fontSize: '13px' }}>
+ <ExpandOutlined style={{ marginRight: 4 }} />
+ {t('aiFeatures.expand' as any)}
+ </div>
+ <Input.TextArea
+ value={customPrompts.expand || ''}
+ onChange={(e) => {
+ const newPrompts = { ...customPrompts, expand: e.target.value }
+ setCustomPrompts(newPrompts)
+ localStorage.setItem('ai_custom_prompts', JSON.stringify(newPrompts))
+ }}
+ placeholder={t('aiFeatures.customPrompts.placeholder' as any)}
+ rows={2}
+ style={{ fontSize: '12px' }}
+ />
+ </div>
+
+ {/* Polish */}
+ <div style={{ marginBottom: 16 }}>
+ <div style={{ marginBottom: 4, fontWeight: 500, fontSize: '13px' }}>
+ <EditOutlined style={{ marginRight: 4 }} />
+ {t('aiFeatures.polish' as any)}
+ </div>
+ <Input.TextArea
+ value={customPrompts.polish || ''}
+ onChange={(e) => {
+ const newPrompts = { ...customPrompts, polish: e.target.value }
+ setCustomPrompts(newPrompts)
+ localStorage.setItem('ai_custom_prompts', JSON.stringify(newPrompts))
+ }}
+ placeholder={t('aiFeatures.customPrompts.placeholder' as any)}
+ rows={2}
+ style={{ fontSize: '12px' }}
+ />
+ </div>
+
+ {/* Translate */}
+ <div style={{ marginBottom: 16 }}>
+ <div style={{ marginBottom: 4, fontWeight: 500, fontSize: '13px' }}>
+ <TranslationOutlined style={{ marginRight: 4 }} />
+ {t('aiFeatures.translate' as any)}
+ </div>
+ <Input.TextArea
+ value={customPrompts.translate || ''}
+ onChange={(e) => {
+ const newPrompts = { ...customPrompts, translate: e.target.value }
+ setCustomPrompts(newPrompts)
+ localStorage.setItem('ai_custom_prompts', JSON.stringify(newPrompts))
+ }}
+ placeholder={t('aiFeatures.customPrompts.placeholder' as any)}
+ rows={2}
+ style={{ fontSize: '12px' }}
+ />
+ </div>
+
+ {/* Generate Image */}
+ <div style={{ marginBottom: 16 }}>
+ <div style={{ marginBottom: 4, fontWeight: 500, fontSize: '13px' }}>
+ <PictureOutlined style={{ marginRight: 4 }} />
+ {t('aiFeatures.generateImage' as any)}
+ </div>
+ <Input.TextArea
+ value={customPrompts.generateImage || ''}
+ onChange={(e) => {
+ const newPrompts = { ...customPrompts, generateImage: e.target.value }
+ setCustomPrompts(newPrompts)
+ localStorage.setItem('ai_custom_prompts', JSON.stringify(newPrompts))
+ }}
+ placeholder={t('aiFeatures.customPrompts.placeholder' as any)}
+ rows={2}
+ style={{ fontSize: '12px' }}
+ />
+ </div>
+
+ {/* Generate Video */}
+ <div style={{ marginBottom: 16 }}>
+ <div style={{ marginBottom: 4, fontWeight: 500, fontSize: '13px' }}>
+ <VideoCameraOutlined style={{ marginRight: 4 }} />
+ {t('aiFeatures.generateVideo' as any)}
+ </div>
+ <Input.TextArea
+ value={customPrompts.generateVideo || ''}
+ onChange={(e) => {
+ const newPrompts = { ...customPrompts, generateVideo: e.target.value }
+ setCustomPrompts(newPrompts)
+ localStorage.setItem('ai_custom_prompts', JSON.stringify(newPrompts))
+ }}
+ placeholder={t('aiFeatures.customPrompts.placeholder' as any)}
+ rows={2}
+ style={{ fontSize: '12px' }}
+ />
+ </div>
+
+ {/* Generate Hashtags */}
+ <div style={{ marginBottom: 16 }}>
+ <div style={{ marginBottom: 4, fontWeight: 500, fontSize: '13px' }}>
+ <TagsOutlined style={{ marginRight: 4 }} />
+ {t('aiFeatures.generateHashtags' as any)}
+ </div>
+ <Input.TextArea
+ value={customPrompts.generateHashtags || ''}
+ onChange={(e) => {
+ const newPrompts = { ...customPrompts, generateHashtags: e.target.value }
+ setCustomPrompts(newPrompts)
+ localStorage.setItem('ai_custom_prompts', JSON.stringify(newPrompts))
+ }}
+ placeholder={t('aiFeatures.customPrompts.placeholder' as any)}
+ rows={2}
+ style={{ fontSize: '12px' }}
+ />
+ </div>
+
+ <Button
+ type="link"
+ danger
+ size="small"
+ onClick={() => {
+ setCustomPrompts({})
+ localStorage.removeItem('ai_custom_prompts')
+ message.success(t('aiFeatures.customPrompts.clearSuccess' as any))
+ }}
+ >
+ {t('aiFeatures.customPrompts.clearAll' as any)}
+ </Button>
+ </div>
+ ),
+ },
+ ]}
+ />
+ </div>
</Modal>
</div>
)
diff --git a/project/web/src/components/PublishDialog/usePublishDialogStorageStore.tsx b/project/web/src/components/PublishDialog/usePublishDialogStorageStore.tsx
index 72ae3eba..5076deae 100644
--- a/project/web/src/components/PublishDialog/usePublishDialogStorageStore.tsx
+++ b/project/web/src/components/PublishDialog/usePublishDialogStorageStore.tsx
@@ -5,6 +5,7 @@ import { usePublishDialog } from '@/components/PublishDialog/usePublishDialog'
import { useAccountStore } from '@/store/account'
import { modalApi, useConfigStore } from '@/store/config'
import { createPersistStore } from '@/utils/createPersistStore'
+import { directTrans } from '@/app/i18n/client'
export interface IPublishDialogStorageStore {
pubData?: PubItem[]
@@ -45,11 +46,11 @@ export const usePublishDialogStorageStore = createPersistStore(
}
// 提示用户是否恢复
modalApi.value.confirm({
- title: '温馨提示',
+ title: directTrans('publish', 'restoreData.title'),
icon: <ExclamationCircleFilled />,
- content: '系统检测到您有未完成的发布记录,是否要恢复?',
- okText: '恢复',
- cancelText: '不恢复',
+ content: directTrans('publish', 'restoreData.content'),
+ okText: directTrans('publish', 'restoreData.okText'),
+ cancelText: directTrans('publish', 'restoreData.cancelText'),
okButtonProps: {
type: 'primary',
},