Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

fix: Fixed Markdown Rendering Logic

albertb8756856ef40
diff --git a/core/frontend/src/views/domain/pages/editDomain/controller/domainConfiguration.controller.ts b/core/frontend/src/views/domain/pages/editDomain/controller/domainConfiguration.controller.ts
index bf6a93b3..ea94d7fe 100644
--- a/core/frontend/src/views/domain/pages/editDomain/controller/domainConfiguration.controller.ts
+++ b/core/frontend/src/views/domain/pages/editDomain/controller/domainConfiguration.controller.ts
@@ -43,7 +43,8 @@ export async function getDomainDetail(domain: string) {
unit.value = quotaAndUnit[1]
mailboxes.value = list[0].mailboxes
catch_email.value = list[0].email
- urls.value = list[0].urls
+ urls.value =
+ list[0].urls && list[0].urls.length > 0 && list[0].urls[0] != '' ? list[0].urls : ['https://']
await configurationStatus(domain)
hasGotDomainConfiguration.value = true
} catch (error) {
@@ -114,7 +115,7 @@ export async function createBrandInfo() {
const globalStore = useGlobalStore()
hasGotDomainConfiguration.value = false
if (urls.value.length == 0 || urls.value[0] == '') {
- Message.error(i18n.global.t("domain.edit.domainConfiguration.fillDomain"))
+ Message.error(i18n.global.t('domain.edit.domainConfiguration.fillDomain'))
} else {
try {
await initAiConfiguration({
diff --git a/core/frontend/src/views/settings/ai-model/controller/index.ts b/core/frontend/src/views/settings/ai-model/controller/index.ts
index df3d0e4b..412d95b0 100644
--- a/core/frontend/src/views/settings/ai-model/controller/index.ts
+++ b/core/frontend/src/views/settings/ai-model/controller/index.ts
@@ -112,6 +112,7 @@ export async function changeProviderStatus(status: boolean, modelStore: ModelSto
{ supplierName: currentProvider.value.supplierName, status },
instanceOptions
)
+ getModelList(currentProvider.value.supplierName, modelStore)
} catch (error) {
currentProvider.value.status = !status
console.warn(error)
diff --git a/core/frontend/src/views/template/pages/AITemplate/components/MarkdownRender.vue b/core/frontend/src/views/template/pages/AITemplate/components/MarkdownRender.vue
index 0254ad24..cae5c07c 100644
--- a/core/frontend/src/views/template/pages/AITemplate/components/MarkdownRender.vue
+++ b/core/frontend/src/views/template/pages/AITemplate/components/MarkdownRender.vue
@@ -62,6 +62,7 @@ const md = markdownit({
return md.utils.escapeHtml(str) // 使用额外的默认转义
},
})
+
codeHtml.value = md.render(removeSignCode(props.content))
watch(
() => props.content,
diff --git a/core/frontend/src/views/template/pages/AITemplate/highlight.theme.css b/core/frontend/src/views/template/pages/AITemplate/highlight.theme.css
index 79d29146..25e0e0ed 100644
--- a/core/frontend/src/views/template/pages/AITemplate/highlight.theme.css
+++ b/core/frontend/src/views/template/pages/AITemplate/highlight.theme.css
@@ -7,9 +7,11 @@ pre code.hljs {
padding: 3px 5px
}
- pre {
+.code-area {
+ pre {
color: var(--color-bg-2) !important;
}
+}
/*
Atom One Dark by Daniel Gamage
diff --git a/core/frontend/src/views/template/pages/AITemplate/store/index.ts b/core/frontend/src/views/template/pages/AITemplate/store/index.ts
index 21ace04c..d7d9865f 100644
--- a/core/frontend/src/views/template/pages/AITemplate/store/index.ts
+++ b/core/frontend/src/views/template/pages/AITemplate/store/index.ts
@@ -1,5 +1,5 @@
import { ChatInfo, Model, TemplateStore } from "../dto"
-
+import { str } from "./test"
export function useTemplateStore(): TemplateStore {
const domainList = ref<string[]>([])
const sourceDomain = ref("")
@@ -31,7 +31,9 @@ export function useTemplateStore(): TemplateStore {
const answerContent = ref<string[]>([])
const previewCode = ref<string>("")
const generateShow = ref<boolean>(false)
- const chatRecord = ref<Map<string, string[]>>(new Map())
+ const chatRecord = ref<Map<string, string[]>>(new Map([
+ ["帮我像一个问题",[str]]
+ ]))
const isChat = ref(false)
const chatScrollRef = ref()
const scrollWrapperRef = ref()
diff --git a/core/frontend/src/views/template/pages/AITemplate/store/test.ts b/core/frontend/src/views/template/pages/AITemplate/store/test.ts
new file mode 100644
index 00000000..2a49c7f6
--- /dev/null
+++ b/core/frontend/src/views/template/pages/AITemplate/store/test.ts
@@ -0,0 +1,97 @@
+export const str = `We are creating a welcome email for BillionMail. The email should be visually appealing and have high conversion.
+ We are given company information and style configurations.
+
+ Steps:
+ 1. Use the provided style config:
+ - AccentColor: #f6f6f7 (use as background for some sections, but note: it's very light, almost white)
+ - TextColor: #3c3c43 (for text)
+ - PageBackground: #ffffff (body background)
+ - ContainerBackground: #ffffff (container background)
+ - LinkSocialColor: #67676c (for social links, but we might not have social in this email)
+ - LinkFooterColor: #20a53a (for unsubscribe and other footer links)
+ - Fonts: Inter, but since we are in email, we'll use fallback fonts: 'Inter', Arial, sans-serif
+
+ 2. The email must have:
+ - A subject: We'll put in the title and also as a hidden preview text.
+ - Preheader text (hidden but shown in inbox preview)
+ - A header with logo and maybe a welcome message.
+ - Body content: Thank the user, highlight key benefits, and include a call to action (like getting started).
+ - Footer: Copyright, disclaimer, and unsubscribe link.
+
+ 3. We are to use placeholder for unsubscribe: {{ UnsubscribeURL . }}
+
+ 4. We have a logo from the company: PrimaryLogo: https://www.billionmail.com/logo.png
+
+ 5. We can use emojis for icons.
+
+ 6. We are to design for 600px max width.
+
+ 7. We have knowledge base content that we can use for the body. We are to create a welcome email, so we don't need to replicate the entire homepage, but we can highlight:
+
+ - Open-source, self-hosted, free from monthly fees.
+ - Quick setup (8 minutes to install)
+ - Features: Cold Email Partner, Higher Deliverability, Data Visualization Dashboard.
+
+ 8. We have images, but we should use sparingly and with alt text. We have:
+ Image 1: https://www.billionmail.com/home.png (Alt: BillionMail)
+ Image 2: https://img.youtube.com/vi/UHgxZa_9jGs/maxresdefault.jpg (we can use as a thumbnail for a video)
+
+ 9. We can include a button for getting started (QuickStart link: /start/quickstart.html -> full URL: https://www.billionmail.com/start/quickstart.html)
+
+ 10. We are to use the color scheme: Primary (60%) + Secondary (30%) + Accent (10%).
+ Let's define:
+ Primary: #20a53a (from LinkFooterColor, which is a green) - we can use for buttons and important highlights.
+ Secondary: #3c3c43 (TextColor) for text and some elements.
+ Accent: #f6f6f7 (AccentColor) for backgrounds.
+
+ But note: the style config has AccentColor as #f6f6f7 and TextColor as #3c3c43. We also have LinkFooterColor #20a53a which is a bright green.
+
+ We'll use:
+ Primary: #20a53a (green) for buttons and key highlights (60%)
+ Secondary: #3c3c43 (dark gray) for text and headings (30%)
+ Accent: #f6f6f7 (very light gray) for backgrounds (10%)
+
+ 11. We are to compress CSS into a single line. But for development, we'll write it in a readable way and then minify.
+
+ 12. We are to include a hidden preview text.
+
+ Let's structure the email:
+
+ - Preheader (hidden div with preview text)
+ - Container (max-width: 600px; margin: auto; background: #ffffff)
+ - Header:
+ Logo (centered, with link to home)
+ Welcome heading: "Welcome to BillionMail!" (using h1)
+ Subheading: "Thank you for joining the open-source email revolution"
+ - Main content:
+ A short paragraph: "You've taken the first step towards owning your email infrastructure. With BillionMail, you get a powerful, self-hosted mail server and email marketing solution — free from monthly fees and fully under your control."
+ Key features (using emojis and bold text):
+ - 📧 Cold Email Partner: Unlimited email sending, no built-in speed limit.
+ - 🛬 Higher Deliverability: Step-by-step guidance for DNS records and real-time analytics.
+ - 📊 Data Visualization Dashboard: Real-time metrics for your campaigns.
+ Get started button: "Get Started in Minutes" -> links to QuickStart page.
+ Image: We can use the home.png image to show the dashboard? (but note: images might be blocked, so we'll set alt text and style accordingly)
+ - Secondary content:
+ "Just 3 steps to send a billion emails!" (with emoji: 💌)
+ Steps (in a table or divs with numbers):
+ 1. Install BillionMail: Only 8 minutes.
+ 2. Connect Your Domain: Add domain, verify DNS, enable SSL.
+ 3. Build Your Campaign: Write email, choose list, send.
+ Another button: "Watch on YouTube" (if we have a video) and "Star us on GitHub"
+ - Footer:
+ Copyright and disclaimer.
+ Unsubscribe link.
+
+ 13. We'll use tables for layout to ensure email client compatibility.
+
+ 14. We'll include a hidden preview text at the top.
+
+ Implementation:
+
+ We'll write the HTML and CSS. We'll use inline styles. We'll minify the CSS at the end.
+
+ We are to output the entire HTML in a code block.
+
+ Let's code accordingly.
+`
+