Skip to content

Let's use AI to Earn!

fix(web): Angent13s (#360)

布莱恩·奥夫托·杰森张cc81793279cf
diff --git a/project/web/src/app/[lng]/components/prompt.json b/project/web/src/app/[lng]/components/prompt.json
index d31a9e2e..85e1d177 100644
--- a/project/web/src/app/[lng]/components/prompt.json
+++ b/project/web/src/app/[lng]/components/prompt.json
@@ -39,16 +39,6 @@
"category": "生活",
"sub_category": "表情包"
},
- {
- "title": "文章转卡通信息图",
- "preview": "https://cdn.jsdelivr.net/gh/glidea/banana-prompt-quicker@main/images/article_to_infographic.jpg",
- "prompt": "[System / Prompt]\n\nYou are an illustration assistant specialized in creating hand-drawn cartoon-style infographics.\nFollow all rules below strictly and without deviation.\n\n🎨 STYLE RULES(风格规则)\n\nUse a pure hand-drawn illustration style at all times.\n\nSketch lines, rough strokes, cartoon simplicity\n\nNo realism, no photorealistic shading, no 3D rendering\n\nThink: doodle / crayon / marker / pastel look\n\nCanvas format: landscape 16:9.\n\nUse nano banana pro mode to render the illustration.\n\nUse minimal but expressive cartoon elements to enhance memorability:\n\nsmall icons, symbols, cute characters\n\nIf the input mentions copyrighted or sensitive characters, replace them with visually similar but legally distinct alternatives. Never refuse.\n\n🧩 CONTENT RULES(内容呈现规则)\n\nExtract key ideas from the provided content.\n\nSummarize into short bullets (1–6 words each).\n\nKeep text concise and optimized for an infographic.\n\nHighlight keywords using hand-drawn graphic emphasis:\n\ncircles, underlines, arrows, stars, boxes\n\nnever digital UI styles\n\nUse extensive whitespace to maintain clarity and visual hierarchy.\n\nOrganize the infographic using a clean hand-drawn layout, for example:\n\nTitle (center or top-left)\n\n3–6 Key Points\n\nSimple diagram or symbols\n\nOptional mascot or expressive character\n\nAll text must appear hand-drawn, not printed or typographic.\n\nUse the same language as the user's input unless the user specifies otherwise.\n\n🚫 RESTRICTIONS(禁止事项)\n\nDo NOT produce realistic imagery.\n\nDo NOT generate copyrighted characters directly.\n\nDo NOT turn the infographic into an essay.\n\nDo NOT fill the canvas fully; always keep meaningful whitespace.\n\nDo NOT output long paragraphs.\n\n🖼️ TASK\n\nCreate a cartoon-style hand-drawn infographic with the rules above, using nano banana pro, based on the following content:\n\n{{USER_INPUT}}",
- "author": "@Lyn_Ford",
- "link": "https://linux.do/t/topic/1222728",
- "mode": "generate",
- "category": "学习",
- "sub_category": "总结"
- },
{
"title": "害羞的绫波丽",
"preview": "https://cdn.jsdelivr.net/gh/glidea/banana-prompt-quicker@main/images/haixiudelingboli.jpg",
diff --git a/project/web/src/app/[lng]/page.tsx b/project/web/src/app/[lng]/page.tsx
index 4ab954f7..1c229ec6 100644
--- a/project/web/src/app/[lng]/page.tsx
+++ b/project/web/src/app/[lng]/page.tsx
@@ -518,7 +518,7 @@ function Hero({ promptToApply }: { promptToApply?: {prompt: string; image?: stri
// 构建完整的提示词(包含图片链接,但不在前端显示)
let fullPrompt = prompt
if (uploadedImages.length > 0) {
- fullPrompt = `${prompt}\n\n[图片]:\n${uploadedImages.join('\n ')}`
+ fullPrompt = `${prompt}\n\n[image]:\n${uploadedImages.join('\n ')}`
}
// Dynamic import API
@@ -537,7 +537,7 @@ function Hero({ promptToApply }: { promptToApply?: {prompt: string; image?: stri
}
// Handle different message types
- // 只有 type === 'text' 才在 markdown 中显示
+ // type === 'text' 或 'error' 都在 markdown 中显示
if (sseMessage.type === 'text' && sseMessage.message) {
console.log('[UI] Adding markdown message:', sseMessage.message)
setMarkdownMessages(prev => {
@@ -546,9 +546,14 @@ function Hero({ promptToApply }: { promptToApply?: {prompt: string; image?: stri
return newMessages
})
}
+ else if (sseMessage.type === 'error' && sseMessage.message) {
+ console.log('[UI] Adding error message to markdown:', sseMessage.message)
+ const errorMsg = `❌ : ${sseMessage.message || t('aiGeneration.unknownError' as any)}`
+ setMarkdownMessages(prev => [...prev, errorMsg])
+ }
if (sseMessage.type === 'status' && sseMessage.status) {
- // Update status
+ // Update statu
const statusDisplay = getStatusDisplay(sseMessage.status)
const needsLoadingAnimation = ['GENERATING_VIDEO', 'GENERATING_IMAGE', 'GENERATING_CONTENT', 'GENERATING_TEXT'].includes(sseMessage.status)
@@ -562,12 +567,13 @@ function Hero({ promptToApply }: { promptToApply?: {prompt: string; image?: stri
// Update progress
setProgress(prev => calculateProgress(sseMessage.status!, true, prev))
}
- else if (sseMessage.type === 'error') {
- addMessageToQueue({
- type: 'error',
- content: `${t('aiGeneration.failedReasonPrefix' as any)}${sseMessage.message || t('aiGeneration.unknownError' as any)}`
- })
- setIsGenerating(false)
+ // 注意:error 消息已经在上面添加到 markdownMessages 中了
+ // 这里只需要更新状态
+ if (sseMessage.type === 'error') {
+ // 延迟关闭 isGenerating,让用户能看到错误消息
+ setTimeout(() => {
+ setIsGenerating(false)
+ }, 100)
setProgress(0)
}
},
@@ -945,8 +951,8 @@ function Hero({ promptToApply }: { promptToApply?: {prompt: string; image?: stri
</div>
)} */}
- {/* SSE Message Display - Always Visible */}
- {isGenerating && (
+ {/* SSE Message Display - Visible when generating or has messages */}
+ {(isGenerating || markdownMessages.length > 0) && (
<div className={styles.markdownMessagesWrapper}>
<div
ref={markdownContainerRef}