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 the issue caused by mismatched HTML code
hwliang52e14ff8d088
diff --git a/core/internal/service/askai/chat.go b/core/internal/service/askai/chat.goindex e20ac9ac..d713885a 100644--- a/core/internal/service/askai/chat.go+++ b/core/internal/service/askai/chat.go@@ -323,9 +323,9 @@ func GetHtml(chatId string) (string, error) {// This function should handle the logic for modifying the HTML content of a chat based on the provided chat ID and contentfunc ModifyHtml(chatId string, content string) error {filename := CHAT_CONFIG_PATH + "/" + chatId + "/code.html"- if !public.FileExists(filename) {- return errors.New("HTML file not found")- }+ // if !public.FileExists(filename) {+ // return errors.New("HTML file not found")+ // }g.DB().Model("email_templates").Where("chat_id", chatId).Update(g.Map{"content": content, // Update the HTML content in the database})diff --git a/core/internal/service/askai/openai.go b/core/internal/service/askai/openai.goindex 57055d65..50b9c7f7 100644--- a/core/internal/service/askai/openai.go+++ b/core/internal/service/askai/openai.go@@ -717,12 +717,11 @@ func (o *OpenAI) CreateChatCompletionStream(request *ghttp.Request, req openai.Creturn o.CreateChatCompletionStream(request, req, isText)}- if o.Content != "" {- // Ensure the response is properly closed- o.WriteHtml() // Write HTML content if the chat has ended- o.WriteMessage(o.Content, finishReason) // Write the final message to the chat- o.WriteEvent(request, "", isText, true) // Write final event to indicate completion- }+ // Ensure the response is properly closed+ o.WriteHtml() // Write HTML content if the chat has ended+ o.WriteMessage(o.Content, finishReason) // Write the final message to the chat+ o.WriteEvent(request, "", isText, true) // Write final event to indicate completion+return nil}@@ -825,10 +824,10 @@ func (o *OpenAI) ReplaceHtml() {// WriteHtml writes the HTML content to a file if it existsfunc (o *OpenAI) WriteHtml() {- if o.IsModify {- o.ReplaceHtml() // Replace HTML content if modifying- return- }+ // if o.IsModify {+ // o.ReplaceHtml() // Replace HTML content if modifying+ // return+ // }if o.HtmlContent != "" {filename := CHAT_CONFIG_PATH + "/" + o.ChatId + "/code.html"o.HtmlContent = strings.Trim(o.HtmlContent, "`")