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: Fix some issues

albert021d1bfae5fc
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 2cceeffc..6d50d337 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
@@ -44,7 +44,7 @@ export async function getDomainDetail(domain: string) {
mailboxes.value = list[0].mailboxes
catch_email.value = list[0].email
urls.value =
- list[0].urls && list[0].urls.length > 0 && list[0].urls[0] != '' ? list[0].urls : ['https://']
+ list[0].urls && list[0].urls.length > 0 && list[0].urls[0] != '' ? list[0].urls : [`https://${domain}`]
await configurationStatus(domain)
hasGotDomainConfiguration.value = true
} catch (error) {
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 412d95b0..cb74d9c9 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
)
+ currentProvider.value.status = status
getModelList(currentProvider.value.supplierName, modelStore)
} catch (error) {
currentProvider.value.status = !status
@@ -154,6 +155,7 @@ export async function setProviderConfiguration(modelStore: ModelStore) {
},
instanceOptions
)
+ changeProviderStatus(true, modelStore)
} catch (error) {
console.warn(error)
}
diff --git a/core/frontend/src/views/template/components/CreateTplModal.vue b/core/frontend/src/views/template/components/CreateTplModal.vue
index 0f9e7e6b..3a0c67f6 100644
--- a/core/frontend/src/views/template/components/CreateTplModal.vue
+++ b/core/frontend/src/views/template/components/CreateTplModal.vue
@@ -11,7 +11,7 @@
<div :class="['url-source', { hidden: choosedMethod !== 'AI' }]">
<span class="label">{{ $t("template.createTpl.sourceUrl") }}</span>
<n-select v-model:value="sourceDomain" class="flex-1" label-field="domain" value-field="domain"
- :options="domainListHasBrandInfo">
+ :options="domainListHasBrandInfo" disabled>
</n-select>
</div>
<div class="desc">
@@ -21,158 +21,172 @@
<template #footer>
<div class="flex justify-end">
- <n-button type="primary" @click="createTemplate">{{ $t("template.createTpl.create") }}</n-button>
+ <n-button type="primary" :disabled="canNotUse" @click="createTemplate">{{ $t("template.createTpl.create") }}</n-button>
</div>
</template>
</n-modal>
</template>
<script setup lang="ts">
- import { instance } from '@/api'
- import { createAiTemplate } from '../pages/AITemplate/controller'
- import { useGlobalStore } from '@/store'
- // import { TemplateStore } from '../pages/AITemplate/dto'
-
- // const store = inject<TemplateStore>('modelStore')!
- const props = defineProps<{
- onlyAi?: boolean,
- }>()
- const globalStore = useGlobalStore()
- const router = useRouter()
- const methodsList = ref(['Drag', 'AI', 'HTML'])
- const choosedMethod = ref('AI')
- const sourceDomain = ref('')
- const show = ref(false)
- const emits = defineEmits(['confirmType','hasCreateTpl'])
- const domainList = ref<any>([])
-
- const computedMethodsList = computed(() => {
- if (props.onlyAi) {
- return ["AI"]
- } else {
- return methodsList.value
- }
- })
-
- const domainListHasBrandInfo = computed(() => {
- return domainList.value.filter((item: any) => item.hasbrandinfo == 1)
- })
-
- /**
- * @description open modal
- */
- function open() {
- getDomainList()
- if(globalStore.domainSource){
- globalStore.domainSource = sourceDomain.value
- }
- show.value = true
+import { instance } from '@/api'
+import { createAiTemplate } from '../pages/AITemplate/controller'
+import { useGlobalStore } from '@/store'
+// import { TemplateStore } from '../pages/AITemplate/dto'
+
+// const store = inject<TemplateStore>('modelStore')!
+const props = defineProps<{
+ onlyAi?: boolean,
+}>()
+const globalStore = useGlobalStore()
+const router = useRouter()
+const methodsList = ref(['Drag', 'AI', 'HTML'])
+const choosedMethod = ref('AI')
+const sourceDomain = ref('')
+const show = ref(false)
+const emits = defineEmits(['confirmType', 'hasCreateTpl'])
+const domainList = ref<any>([])
+
+const computedMethodsList = computed(() => {
+ if (props.onlyAi) {
+ return ["AI"]
+ } else {
+ return methodsList.value
}
-
- /**
- * @description close modal
- */
- function close() {
- show.value = false
+})
+
+const domainListHasBrandInfo = computed(() => {
+ return domainList.value.filter((item: any) => item.hasbrandinfo == 1)
+})
+
+/**
+ * @description Whether the button can be used
+ */
+const canNotUse = computed(() => {
+ if(choosedMethod.value == 'AI' && domainList.value.length == 0){
+ return true
}
-
- /**
- * @description jump
- */
- async function createTemplate() {
- if (choosedMethod.value == 'AI') {
- const chatId = await createAiTemplate(sourceDomain.value)
- if (chatId) {
- globalStore.domainSource = sourceDomain.value
- router.push({ name: 'ai-template', params: { chatId } })
- }
- } else {
- emits('confirmType', choosedMethod.value)
- }
+ return false
+})
+
+/**
+ * @description open modal
+ */
+function open() {
+ getDomainList()
+ if (globalStore.domainSource) {
+ globalStore.domainSource = sourceDomain.value
}
- defineExpose({
- open,
- close,
- })
-
- /**
- * @description Get domain list
- */
- async function getDomainList() {
- const res = (await instance.get('/domains/list', {
- params: {
- page: 1,
- page_size: 100,
- },
- })) as Record<string, any>
- domainList.value = res.list
- if (globalStore.domainSource) {
- sourceDomain.value = globalStore.domainSource
- } else {
- sourceDomain.value = domainList.value[0].domain
+ show.value = true
+}
+
+/**
+ * @description close modal
+ */
+function close() {
+ show.value = false
+}
+
+/**
+ * @description jump
+ */
+async function createTemplate() {
+ if (choosedMethod.value == 'AI') {
+ const chatId = await createAiTemplate(sourceDomain.value)
+ if (chatId) {
+ globalStore.domainSource = sourceDomain.value
+ router.push({ name: 'ai-template', params: { chatId } })
}
+ } else {
+ emits('confirmType', choosedMethod.value)
+ }
+}
+defineExpose({
+ open,
+ close,
+})
+
+/**
+ * @description Get domain list
+ */
+async function getDomainList() {
+ const res = (await instance.get('/domains/list', {
+ params: {
+ page: 1,
+ page_size: 100,
+ },
+ })) as Record<string, any>
+ domainList.value = res.list
+ if (domainList.value.length == 0) {
+ globalStore.domainSource = ''
+ sourceDomain.value = ''
+ return
}
+ if (globalStore.domainSource) {
+ sourceDomain.value = globalStore.domainSource
+ } else {
+ sourceDomain.value = domainList.value[0].domain
+ }
+}
-
</script>
<style scoped lang="scss">
- @use '@/styles/index' as base;
-
- .wrapper {
- @include base.col-flex-center;
- height: 153px;
- gap: 20px;
-
- .creation-methods {
- @include base.row-flex-center;
- border-bottom: 1px solid var(--color-border-1);
- width: 90%;
- gap: 25px;
-
- .choose-item {
- @include base.row-flex-start;
- gap: 5px;
- padding: 6px 15px;
- align-items: center;
- cursor: pointer;
- color: var(--color-text-2);
- transition: 0.1s all ease-in-out;
- box-sizing: border-box;
-
- .item-label {
- font-size: 16px;
- transition: 0.2s all ease-in-out;
- }
-
- &:hover {
- color: var(--color-primary-1);
- // transform: scale(1.3) translate(0, -5px);
- }
-
- &.active {
- color: var(--color-primary-1);
- transform: scale(1.3) translate(0, -5px);
- font-weight: bold;
- border-bottom: 2px solid var(--color-primary-1);
- }
- }
- }
+@use '@/styles/index' as base;
+
+.wrapper {
+ @include base.col-flex-center;
+ height: 153px;
+ gap: 20px;
+
+ .creation-methods {
+ @include base.row-flex-center;
+ border-bottom: 1px solid var(--color-border-1);
+ width: 90%;
+ gap: 25px;
- .url-source {
- width: 90%;
+ .choose-item {
@include base.row-flex-start;
- gap: 10px;
+ gap: 5px;
+ padding: 6px 15px;
+ align-items: center;
+ cursor: pointer;
+ color: var(--color-text-2);
+ transition: 0.1s all ease-in-out;
+ box-sizing: border-box;
+
+ .item-label {
+ font-size: 16px;
+ transition: 0.2s all ease-in-out;
+ }
+
+ &:hover {
+ color: var(--color-primary-1);
+ // transform: scale(1.3) translate(0, -5px);
+ }
- &.hidden {
- visibility: hidden;
+ &.active {
+ color: var(--color-primary-1);
+ transform: scale(1.3) translate(0, -5px);
+ font-weight: bold;
+ border-bottom: 2px solid var(--color-primary-1);
}
}
+ }
+
+ .url-source {
+ width: 90%;
+ @include base.row-flex-start;
+ gap: 10px;
- .desc {
- width: 90%;
- font-size: 14px;
- color: var(--color-text-3);
+ &.hidden {
+ visibility: hidden;
}
}
+
+ .desc {
+ width: 90%;
+ font-size: 14px;
+ color: var(--color-text-3);
+ }
+}
</style>