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: Prohibit deleting the system's built-in model suppliers The issue of incorrect capitalization of supplerName in OpenAI templates

hwliang9e45cb59517e
diff --git a/conf/supplier/template/OpenAI/config.json b/conf/supplier/template/OpenAI/config.json
index 0e75aa92..f1cef91f 100644
--- a/conf/supplier/template/OpenAI/config.json
+++ b/conf/supplier/template/OpenAI/config.json
@@ -1,6 +1,6 @@
{
"supplierTitle": "OpenAI",
- "supplierName": "openai",
+ "supplierName": "OpenAI",
"baseUrl": "",
"baseUrlExample":"https://api.openai.com/v1",
"isUseUrlExample": true,
diff --git a/core/internal/service/askai/supplier.go b/core/internal/service/askai/supplier.go
index fd418c61..f0326519 100644
--- a/core/internal/service/askai/supplier.go
+++ b/core/internal/service/askai/supplier.go
@@ -544,6 +544,10 @@ func RemoveSupplier(supplierName string) error {
if !public.FileExists(supplierPath) {
return errors.New("supplier does not exist")
}
+ templatePath := SUPPLIER_TEMPLATE_PATH + "/" + supplierName
+ if public.FileExists(templatePath) {
+ return errors.New("Cannot delete the system's built-in model supplier.")
+ }
err := os.RemoveAll(supplierPath)
if err != nil {