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

Adjusting file format issues

zdm578beb9cc6cd
diff --git a/core/frontend/.env.development b/core/frontend/.env.development
index 35d3ecfe..df472d04 100644
--- a/core/frontend/.env.development
+++ b/core/frontend/.env.development
@@ -3,7 +3,4 @@ NODE_ENV = 'development'
# API Prefix
API_URL_PREFIX = '/api'
-SERVER_NAME = '192.168.10.35'
-
-# 35机器账户:Pm5XFO5M
-# 35机器密码:rjmieOH3
\ No newline at end of file
+SERVER_NAME = '192.168.66.124'
diff --git a/core/frontend/.env.production b/core/frontend/.env.production
index be588a12..397f4308 100644
--- a/core/frontend/.env.production
+++ b/core/frontend/.env.production
@@ -3,4 +3,4 @@ NODE_ENV = 'production'
# API Prefix
API_URL_PREFIX = ''
-SERVER_NAME = '192.168.10.35'
+SERVER_NAME = '192.168.66.124'
diff --git a/core/frontend/.gitignore b/core/frontend/.gitignore
index ed310143..099879d2 100644
--- a/core/frontend/.gitignore
+++ b/core/frontend/.gitignore
@@ -15,3 +15,6 @@ dist/
deploy.js
build/config.ts
+
+pnpm-lock.yaml
+yarn.lock
diff --git a/core/frontend/package.json b/core/frontend/package.json
index d7cd3458..35417898 100644
--- a/core/frontend/package.json
+++ b/core/frontend/package.json
@@ -4,8 +4,9 @@
"private": true,
"type": "module",
"scripts": {
- "build": "rsbuild build && node deploy.js",
- "dev": "rsbuild dev --open",
+ "build": "rsbuild build",
+ "build:deploy": "rsbuild build && node deploy.js",
+ "dev": "rsbuild dev",
"operation": "rsbuild dev RSBUILD_MODE=operation --open --mode=development",
"preview": "rsbuild preview",
"format": "prettier --write .",
diff --git a/core/frontend/pnpm-lock.yaml b/core/frontend/pnpm-lock.yaml
index de41cbb1..474d27d6 100644
--- a/core/frontend/pnpm-lock.yaml
+++ b/core/frontend/pnpm-lock.yaml
@@ -41,6 +41,9 @@ importers:
lodash-es:
specifier: ^4.17.21
version: 4.17.21
+ markdown-it:
+ specifier: ^14.1.0
+ version: 14.1.0
marked:
specifier: ^16.0.0
version: 16.0.0
@@ -114,6 +117,9 @@ importers:
'@types/lodash-es':
specifier: ^4.17.12
version: 4.17.12
+ '@types/markdown-it':
+ specifier: ^14.1.2
+ version: 14.1.2
'@typescript-eslint/eslint-plugin':
specifier: ^8.28.0
@@ -1066,12 +1072,21 @@ packages:
resolution: {integrity: sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==}
+
resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==}
resolution: {integrity: sha512-RRVJ+J3J+WmyOTqnz3PiBLA501eKwXl2noseKOrNo/6+XEHjTAxO4xHvxQB6QuNm+s4WRbn6rSiap8+EA+ykFQ==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==}
+
resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==}
@@ -2345,6 +2360,9 @@ packages:
resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
engines: {node: '>= 0.8.0'}
+ resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==}
+
resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==}
engines: {node: '>=6.11.5'}
@@ -2405,6 +2423,10 @@ packages:
resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==}
+ resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==}
+ hasBin: true
+
resolution: {integrity: sha512-MUKMXDjsD/eptB7GPzxo4xcnLS6oo7/RHimUMHEDRhUooPwmN9BEpMl7AEOJv3bmso169wHI2wUF9VQgL7zfmA==}
engines: {node: '>= 20'}
@@ -2417,6 +2439,9 @@ packages:
resolution: {integrity: sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==}
+ resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==}
+
resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==}
@@ -2665,6 +2690,10 @@ packages:
resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
+ resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==}
+ engines: {node: '>=6'}
+
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
@@ -3141,6 +3170,9 @@ packages:
engines: {node: '>=14.17'}
hasBin: true
+ resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==}
+
resolution: {integrity: sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==}
@@ -4245,12 +4277,21 @@ snapshots:
'@types/[email protected]': {}
+ '@types/[email protected]': {}
+
dependencies:
'@types/lodash': 4.17.17
'@types/[email protected]': {}
+ '@types/[email protected]':
+ dependencies:
+ '@types/linkify-it': 5.0.0
+ '@types/mdurl': 2.0.0
+
+ '@types/[email protected]': {}
+
dependencies:
'@types/node': 22.15.23
@@ -5726,6 +5767,10 @@ snapshots:
prelude-ls: 1.2.1
type-check: 0.4.0
+ dependencies:
+ uc.micro: 2.1.0
+
@@ -5779,12 +5824,23 @@ snapshots:
dependencies:
'@jridgewell/sourcemap-codec': 1.5.0
+ dependencies:
+ argparse: 2.0.1
+ entities: 4.5.0
+ linkify-it: 5.0.0
+ mdurl: 2.0.0
+ punycode.js: 2.3.1
+ uc.micro: 2.1.0
+
+
@@ -6031,6 +6087,8 @@ snapshots:
+
@@ -6487,6 +6545,8 @@ snapshots:
+
diff --git a/core/frontend/src/api/index.ts b/core/frontend/src/api/index.ts
index 4f44183d..13067993 100644
--- a/core/frontend/src/api/index.ts
+++ b/core/frontend/src/api/index.ts
@@ -1,4 +1,4 @@
-import axios, { InternalAxiosRequestConfig } from 'axios'
+import axios from 'axios'
import router from '@/router'
import { useUserStore } from '@/store'
import { apiUrlPrefix, isObject, Message } from '@/utils'
diff --git a/core/frontend/src/features/EmailEditor/components/sidebar/Page.vue b/core/frontend/src/features/EmailEditor/components/sidebar/Page.vue
index cc93a067..b212dd28 100644
--- a/core/frontend/src/features/EmailEditor/components/sidebar/Page.vue
+++ b/core/frontend/src/features/EmailEditor/components/sidebar/Page.vue
@@ -6,9 +6,11 @@
<script setup lang="ts">
import { useConfig } from '../../hooks/useConfig'
+import { useSetData } from '../../hooks/useSetData'
import { useNormalForm } from '../style/useNormalForm'
const { pageConfig } = useConfig()
+const { autoSaveFn } = useSetData()
const pageStyle = computed({
get() {
@@ -19,6 +21,16 @@ const pageStyle = computed({
},
})
+watch(
+ () => [pageStyle.value],
+ () => {
+ autoSaveFn()
+ },
+ {
+ deep: true,
+ }
+)
+
const [StyleForm] = useNormalForm([
{
attrKey: 'backgroundColor',
diff --git a/core/frontend/src/views/domain/components/DomainForm.vue b/core/frontend/src/views/domain/components/DomainForm.vue
index bf3f8cb2..f0b8ce37 100644
--- a/core/frontend/src/views/domain/components/DomainForm.vue
+++ b/core/frontend/src/views/domain/components/DomainForm.vue
@@ -18,12 +18,17 @@
</n-popover>
</div>
</template>
- <n-input v-model:value="form.domain" :disabled="isEdit"
+ <n-input
+ v-model:value="form.domain"
+ :disabled="isEdit"
:placeholder="t('domain.form.domainPlaceholder')">
</n-input>
</n-form-item>
<n-form-item v-if="false" label="A记录">
- <n-input v-model:value="form.a_record" :disabled="isEdit" placeholder="请输入A记录,例如:mail.aapanel.com">
+ <n-input
+ v-model:value="form.a_record"
+ :disabled="isEdit"
+ placeholder="请输入A记录,例如:mail.aapanel.com">
</n-input>
</n-form-item>
<n-form-item :label="t('domain.form.quota')">
@@ -34,29 +39,34 @@
</div>
</n-form-item>
<n-form-item :label="t('domain.form.mailboxCount')">
- <n-input-number v-model:value="form.mailboxes" class="flex-1" :min="0" :show-button="false">
+ <n-input-number
+ v-model:value="form.mailboxes"
+ class="flex-1"
+ :min="0"
+ :show-button="false">
</n-input-number>
</n-form-item>
<n-form-item :label="t('domain.form.globalCatch')">
- <n-input v-model:value="form.email" :placeholder="t('domain.form.globalCatchPlaceholder')">
+ <n-input
+ v-model:value="form.email"
+ :placeholder="t('domain.form.globalCatchPlaceholder')">
</n-input>
</n-form-item>
-
<n-form-item label="Automatically create brand information">
<n-switch v-model:value="initAi"></n-switch>
</n-form-item>
- <n-alert style="margin: 0 0 15px 0;" type="warning" :show-icon="false">
+ <n-alert style="margin: 0 0 15px 0" type="warning" :show-icon="false">
<div class="w-100% flex justify-between items-center">
<span class="mr-5">To use this feature, you need to integrate an AI model first.</span>
<n-button type="primary">Integrate immediately</n-button>
</div>
</n-alert>
<div class="text-[#777]">
- AI-driven information import automatically analyzes and creates brand information from email
- domains. After creation, you can modify it at your discretion.
+ AI-driven information import automatically analyzes and creates brand information from
+ email domains. After creation, you can modify it at your discretion.
</div>
- <bt-tips style="margin-bottom: 15px;">
+ <bt-tips style="margin-bottom: 15px">
<li>Extract brand and color</li>
<li>Analyze content structure</li>
<li>Import images and content</li>
@@ -64,8 +74,12 @@
</bt-tips>
<n-form-item label="Specify a domain name">
<div class="w-100% flex flex-col gap-2.5">
- <n-input placeholder="" v-model:value="urls[index]" v-for="(item, index) in urls"
- :key="index"></n-input>
+ <n-input
+ v-for="(item, index) in urls"
+ :key="index"
+ v-model:value="urls[index]"
+ placeholder="">
+ </n-input>
<n-button type="primary" ghost @click="addUrl">
<template #icon>
@@ -81,122 +95,122 @@
</template>
<script lang="ts" setup>
- import { FormRules } from 'naive-ui'
- import { getByteUnit, getNumber } from '@/utils'
- import { useModal } from '@/hooks/modal/useModal'
- import { createDomain, initAiConfiguration, updateDomain } from '@/api/modules/domain'
- import type { MailDomain } from '../interface'
+import { FormRules } from 'naive-ui'
+import { getByteUnit, getNumber } from '@/utils'
+import { useModal } from '@/hooks/modal/useModal'
+import { createDomain, initAiConfiguration, updateDomain } from '@/api/modules/domain'
+import type { MailDomain } from '../interface'
- const { t } = useI18n()
+const { t } = useI18n()
- const isEdit = ref(false)
+const isEdit = ref(false)
- const title = computed(() => {
- return isEdit.value ? t('domain.form.editTitle') : t('domain.form.addTitle')
- })
+const title = computed(() => {
+ return isEdit.value ? t('domain.form.editTitle') : t('domain.form.addTitle')
+})
- const formRef = useTemplateRef('formRef')
- const initAi = ref(false)
- const urls = ref([""])
- const form = reactive({
- domain: '',
- a_record: '',
- quota: 5,
- quota_unit: 'GB',
- mailboxes: 50,
- email: '',
- })
+const formRef = useTemplateRef('formRef')
+const initAi = ref(false)
+const urls = ref([''])
+const form = reactive({
+ domain: '',
+ a_record: '',
+ quota: 5,
+ quota_unit: 'GB',
+ mailboxes: 50,
+ email: '',
+})
- const unitOptions = [
- { label: 'GB', value: 'GB' },
- { label: 'MB', value: 'MB' },
- ]
+const unitOptions = [
+ { label: 'GB', value: 'GB' },
+ { label: 'MB', value: 'MB' },
+]
- const rules: FormRules = {
- domain: {
- trigger: ['blur', 'input'],
- validator: () => {
- if (form.domain.trim() === '') {
- return new Error(t('domain.form.validation.domainRequired'))
- }
- return true
- },
+const rules: FormRules = {
+ domain: {
+ trigger: ['blur', 'input'],
+ validator: () => {
+ if (form.domain.trim() === '') {
+ return new Error(t('domain.form.validation.domainRequired'))
+ }
+ return true
},
- }
+ },
+}
- /**
- * @description Calculate the byte number based on the domain quota and unit
- * @param quota
- * @param quota_unit
- */
- const getQuotaByte = (quota: number, quota_unit: string) => {
- switch (quota_unit) {
- case 'GB':
- return quota * 1024 * 1024 * 1024
- case 'MB':
- return quota * 1024 * 1024
- default:
- return quota
- }
+/**
+ * @description Calculate the byte number based on the domain quota and unit
+ * @param quota
+ * @param quota_unit
+ */
+const getQuotaByte = (quota: number, quota_unit: string) => {
+ switch (quota_unit) {
+ case 'GB':
+ return quota * 1024 * 1024 * 1024
+ case 'MB':
+ return quota * 1024 * 1024
+ default:
+ return quota
}
+}
- const [Modal, modalApi] = useModal({
- onChangeState: isOpen => {
- if (isOpen) {
- const state = modalApi.getState<{ isEdit: boolean; row: MailDomain | null }>()
- isEdit.value = state.isEdit
- if (state.row) {
- const { row } = state
- form.domain = row.domain
- form.a_record = row.a_record
- const quota = getByteUnit(row.quota)
- form.quota = getNumber(quota.split(' ')[0])
- form.quota_unit = quota.split(' ')[1]
- form.mailboxes = row.mailboxes
- form.email = row.email
- }
- } else {
- form.domain = ''
- form.a_record = ''
- form.quota = 5
- form.quota_unit = 'GB'
- form.mailboxes = 50
- form.email = ''
+const [Modal, modalApi] = useModal({
+ onChangeState: isOpen => {
+ if (isOpen) {
+ const state = modalApi.getState<{ isEdit: boolean; row: MailDomain | null }>()
+ isEdit.value = state.isEdit
+ if (state.row) {
+ const { row } = state
+ form.domain = row.domain
+ form.a_record = row.a_record
+ const quota = getByteUnit(row.quota)
+ form.quota = getNumber(quota.split(' ')[0])
+ form.quota_unit = quota.split(' ')[1]
+ form.mailboxes = row.mailboxes
+ form.email = row.email
}
- },
- onConfirm: async () => {
- await formRef.value?.validate()
- if (isEdit.value) {
- await updateDomain({
- domain: form.domain,
- quota: getQuotaByte(form.quota, form.quota_unit),
- mailboxes: form.mailboxes,
- email: form.email,
- })
- } else {
- await createDomain({
+ } else {
+ form.domain = ''
+ form.a_record = ''
+ form.quota = 5
+ form.quota_unit = 'GB'
+ form.mailboxes = 50
+ form.email = ''
+ }
+ },
+ onConfirm: async () => {
+ await formRef.value?.validate()
+ if (isEdit.value) {
+ await updateDomain({
+ domain: form.domain,
+ quota: getQuotaByte(form.quota, form.quota_unit),
+ mailboxes: form.mailboxes,
+ email: form.email,
+ })
+ } else {
+ await createDomain({
+ domain: form.domain,
+ quota: getQuotaByte(form.quota, form.quota_unit),
+ mailboxes: form.mailboxes,
+ email: form.email,
+ })
+ // Init Ai configuration (via. src\api\modules\domain.ts)
+ if (initAi.value) {
+ await initAiConfiguration({
domain: form.domain,
- quota: getQuotaByte(form.quota, form.quota_unit),
- mailboxes: form.mailboxes,
- email: form.email,
+ urls: urls.value,
})
- // Init Ai configuration (via. src\api\modules\domain.ts)
- if (initAi.value) {
- await initAiConfiguration({
- domain: form.domain,
- urls: urls.value
- })
- }
}
- const state = modalApi.getState<{ refresh: Function }>()
- state.refresh()
- },
- })
+ }
+ const state = modalApi.getState<{ refresh: Function }>()
+ state.refresh()
+ },
+})
- /**
- * @description Add url to urls
- */
- function addUrl() {
- urls.value.push("")
- }
+/**
+ * @description Add url to urls
+ */
+function addUrl() {
+ urls.value.push('')
+}
</script>
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/AISettings.vue b/core/frontend/src/views/domain/pages/editDomain/components/AISettings.vue
index e9feef62..03a9f246 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/AISettings.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/AISettings.vue
@@ -1,62 +1,63 @@
<template>
- <div class="content-wrapper">
- <n-card class="mb-5">
- <div class="page-tit" style="margin: 0;">
- <div class="left-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
- </div>
- <span class="tit-content">
- AI Settings
- </span>
- </div>
- </div>
- </n-card>
-
- <n-card>
- <div class="page-tit mb-5">
- <div class="left-tit">
- <span class="tit-content">
- Default AI Instructions
- </span>
- </div>
- </div>
-
- <n-form>
- <n-form-item>
- <template #label><span class="form-label">Instructions for Email Generation</span></template>
- <n-input type="textarea" :rows="13" v-model:value="prompt"></n-input>
- </n-form-item>
- </n-form>
- <div>These instructions will be used as default guidelines when generating new emails. You can override
- these
- instructions for individual emails as needed.</div>
- </n-card>
- </div>
+ <div class="content-wrapper">
+ <n-card class="mb-5">
+ <div class="page-tit" style="margin: 0">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content"> AI Settings </span>
+ </div>
+ </div>
+ </n-card>
+
+ <n-card>
+ <div class="page-tit mb-5">
+ <div class="left-tit">
+ <span class="tit-content"> Default AI Instructions </span>
+ </div>
+ </div>
+
+ <n-form>
+ <n-form-item>
+ <template #label
+ ><span class="form-label">Instructions for Email Generation</span></template
+ >
+ <n-input v-model:value="prompt" type="textarea" :rows="13"></n-input>
+ </n-form-item>
+ </n-form>
+ <div>
+ These instructions will be used as default guidelines when generating new emails. You can
+ override these instructions for individual emails as needed.
+ </div>
+ </n-card>
+ </div>
</template>
<script setup lang="ts">
- import { getAisettingsInfo, updateAisettingsInfo } from "../controller/aiSettings.controller"
- import { getEditDomainStoreData } from '../store';
- const { prompt } = getEditDomainStoreData()
- const route = useRoute()
- const domain = route.params.domain as string
- getAisettingsInfo(domain)
+import { getAisettingsInfo } from '../controller/aiSettings.controller'
+import { getEditDomainStoreData } from '../store'
+
+const { prompt } = getEditDomainStoreData()
+
+const route = useRoute()
+const domain = route.params.domain as string
+getAisettingsInfo(domain)
</script>
<style scoped lang="scss">
- @use "@/styles/index" as base;
- @use "./mixin.scss" as mixin;
+@use '@/styles/index' as base;
+@use './mixin.scss' as mixin;
- .content-wrapper {
- @include mixin.content-wrapper;
+.content-wrapper {
+ @include mixin.content-wrapper;
- .page-tit {
- @include mixin.page-tit;
- }
+ .page-tit {
+ @include mixin.page-tit;
+ }
- .form-label {
- @include mixin.form-label;
- }
- }
-</style>
\ No newline at end of file
+ .form-label {
+ @include mixin.form-label;
+ }
+}
+</style>
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/CompanyProfile.vue b/core/frontend/src/views/domain/pages/editDomain/components/CompanyProfile.vue
index 93579fe7..82534326 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/CompanyProfile.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/CompanyProfile.vue
@@ -1,102 +1,92 @@
<template>
- <div class="content-wrapper">
- <n-card class="mb-5">
- <div class="page-tit">
- <div class="left-tit">
- <div class="left-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
- </div>
- <span class="tit-content">
- Company Detail
- </span>
- </div>
- </div>
- </div>
- </n-card>
+ <div class="content-wrapper">
+ <n-card class="mb-5">
+ <div class="page-tit">
+ <div class="left-tit">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content"> Company Detail </span>
+ </div>
+ </div>
+ </div>
+ </n-card>
- <n-card class="mb-5">
- <n-form>
- <div class="flex justify-between gap-5">
- <n-form-item class="flex-1">
- <template #label><span class="form-label">Legal Company Name</span></template>
- <n-input v-model:value="legal_company_name"></n-input>
- </n-form-item>
- <n-form-item class="flex-1">
- <template #label><span class="form-label">web_site</span></template>
- <n-input v-model:value="web_site"></n-input>
- </n-form-item>
- </div>
- <n-form-item>
- <template #label><span class="form-label">Organization Number</span></template>
- <n-input></n-input>
- </n-form-item>
- <n-form-item>
- <template #label><span class="form-label">Additional Company Information</span></template>
- <n-input type="textarea" :rows="8" v-model:value="company_profile"></n-input>
- </n-form-item>
- </n-form>
- </n-card>
+ <n-card class="mb-5">
+ <n-form>
+ <div class="flex justify-between gap-5">
+ <n-form-item class="flex-1">
+ <template #label><span class="form-label">Legal Company Name</span></template>
+ <n-input v-model:value="legal_company_name"></n-input>
+ </n-form-item>
+ <n-form-item class="flex-1">
+ <template #label><span class="form-label">web_site</span></template>
+ <n-input v-model:value="web_site"></n-input>
+ </n-form-item>
+ </div>
+ <n-form-item>
+ <template #label><span class="form-label">Organization Number</span></template>
+ <n-input></n-input>
+ </n-form-item>
+ <n-form-item>
+ <template #label><span class="form-label">Additional Company Information</span></template>
+ <n-input v-model:value="company_profile" type="textarea" :rows="8"></n-input>
+ </n-form-item>
+ </n-form>
+ </n-card>
- <n-card>
- <div class="page-tit mb-20px">
- <div class="left-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
- </div>
- <span class="tit-content">
- Contact Information
- </span>
- </div>
- </div>
+ <n-card>
+ <div class="page-tit mb-20px">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content"> Contact Information </span>
+ </div>
+ </div>
- <n-form>
- <n-form-item>
- <template #label><span class="form-label">Contact Email</span></template>
- <n-input v-model:value="email"></n-input>
- </n-form-item>
- <n-form-item>
- <template #label><span class="form-label">Phone Number</span></template>
- <n-input v-model:value="phone"></n-input>
- </n-form-item>
- <n-form-item>
- <template #label><span class="form-label">Support URL</span></template>
- <n-input v-model:value="support_url"></n-input>
- </n-form-item>
- </n-form>
- </n-card>
- </div>
+ <n-form>
+ <n-form-item>
+ <template #label><span class="form-label">Contact Email</span></template>
+ <n-input v-model:value="email"></n-input>
+ </n-form-item>
+ <n-form-item>
+ <template #label><span class="form-label">Phone Number</span></template>
+ <n-input v-model:value="phone"></n-input>
+ </n-form-item>
+ <n-form-item>
+ <template #label><span class="form-label">Support URL</span></template>
+ <n-input v-model:value="support_url"></n-input>
+ </n-form-item>
+ </n-form>
+ </n-card>
+ </div>
</template>
<script setup lang="ts">
- import { getCompanuyProfile, updateCompanyProfile } from '../controller/companyProfile.controller';
- import { getEditDomainStoreData } from '../store';
- const {
- legal_company_name,
- web_site,
- phone,
- company_profile,
- email,
- support_url,
- } = getEditDomainStoreData()
- const route = useRoute()
- const domain = route.params.domain as string;
- getCompanuyProfile(domain)
+import { getCompanuyProfile } from '../controller/companyProfile.controller'
+import { getEditDomainStoreData } from '../store'
+const { legal_company_name, web_site, phone, company_profile, email, support_url } =
+ getEditDomainStoreData()
+const route = useRoute()
+const domain = route.params.domain as string
+getCompanuyProfile(domain)
</script>
<style scoped lang="scss">
- @use "@/styles/index" as base;
- @use "./mixin.scss" as mixin;
+@use '@/styles/index' as base;
+@use './mixin.scss' as mixin;
- .content-wrapper {
- @include mixin.content-wrapper;
+.content-wrapper {
+ @include mixin.content-wrapper;
- .page-tit {
- @include mixin.page-tit;
- }
+ .page-tit {
+ @include mixin.page-tit;
+ }
- .form-label {
- @include mixin.form-label;
- }
- }
-</style>
\ No newline at end of file
+ .form-label {
+ @include mixin.form-label;
+ }
+}
+</style>
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/DomainConfiguration.vue b/core/frontend/src/views/domain/pages/editDomain/components/DomainConfiguration.vue
index b9ae236a..a27ca276 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/DomainConfiguration.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/DomainConfiguration.vue
@@ -1,81 +1,82 @@
<template>
- <div class="content-wrapper">
- <div>
- <n-card class="mb-5">
- <!-- title -->
- <div class="page-tit">
- <div class="left-tit">
- <div class="back-tool">
- <i class="i-cuida:mail-outline text-7"></i>
- </div>
- <span class="tit-content">
- Mail Domain Configuration
- </span>
- </div>
- </div>
- </n-card>
- <n-card>
- <!-- form data -->
- <n-form>
- <n-form-item>
- <template #label><span class="form-label">Domain</span></template>
- <n-input v-model:value="domainTit"></n-input>
- </n-form-item>
- <n-form-item label="">
- <template #label><span class="form-label">Domain Quota</span></template>
- <div class="flex justify-between gap-5 items-center w-100%">
- <n-input v-model:value="quota"></n-input>
- <n-select :options="uinitOptions" class="w-20" v-model:value="unit"></n-select>
- </div>
- </n-form-item>
- <n-form-item>
- <template #label><span class="form-label">MailBox Count</span></template>
- <n-input-number v-model:value="mailboxes" :show-button="false"></n-input-number>
- </n-form-item>
- <n-form-item>
- <template #label><span class="form-label">Catch all</span></template>
- <n-input v-model:value="catch_email"></n-input>
- </n-form-item>
- </n-form>
- </n-card>
-
- <n-card class="mt-5">
- <n-form-item label="Automatically create brand information">
- <n-switch v-model:value="initAi"></n-switch>
- </n-form-item>
- <n-alert style="margin: 0 0 15px 0;" type="warning" :show-icon="false" v-if="!configurationStatus">
- <div class="w-100% flex justify-between items-center">
- <span class="mr-5">To use this feature, you need to integrate an AI model first.</span>
- <n-button type="primary">Integrate immediately</n-button>
- </div>
- </n-alert>
- <div class="text-[#777]">
- AI-driven information import automatically analyzes and creates brand information from email
- domains. After creation, you can modify it at your discretion.
- </div>
- <bt-tips style="margin-bottom: 15px;">
- <li>Extract brand and color</li>
- <li>Analyze content structure</li>
- <li>Import images and content</li>
- <li>Use a custom logo (optional)</li>
- </bt-tips>
- <n-form-item label="Specify a domain name">
- <div class="w-100% flex flex-col gap-2.5">
- <n-input placeholder="" v-for="(_, index) in urls" :key="index"
- v-model:value="urls[index]"></n-input>
- <n-button type="primary" ghost @click="addUrl">
- <template #icon>
- <i class="i-material-symbols:add-circle-outline"></i>
- </template>
- Add more URLs
- </n-button>
- </div>
- </n-form-item>
- </n-card>
- </div>
-
-
- <!-- <n-card class="my-5">
+ <div class="content-wrapper">
+ <div>
+ <n-card class="mb-5">
+ <!-- title -->
+ <div class="page-tit">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-cuida:mail-outline text-7"></i>
+ </div>
+ <span class="tit-content"> Mail Domain Configuration </span>
+ </div>
+ </div>
+ </n-card>
+ <n-card>
+ <!-- form data -->
+ <n-form>
+ <n-form-item>
+ <template #label><span class="form-label">Domain</span></template>
+ <n-input v-model:value="domainTit"></n-input>
+ </n-form-item>
+ <n-form-item label="">
+ <template #label><span class="form-label">Domain Quota</span></template>
+ <div class="flex justify-between gap-5 items-center w-100%">
+ <n-input v-model:value="quota"></n-input>
+ <n-select v-model:value="unit" :options="uinitOptions" class="w-20"></n-select>
+ </div>
+ </n-form-item>
+ <n-form-item>
+ <template #label><span class="form-label">MailBox Count</span></template>
+ <n-input-number v-model:value="mailboxes" :show-button="false"></n-input-number>
+ </n-form-item>
+ <n-form-item>
+ <template #label><span class="form-label">Catch all</span></template>
+ <n-input v-model:value="catch_email"></n-input>
+ </n-form-item>
+ </n-form>
+ </n-card>
+
+ <n-card class="mt-5">
+ <n-form-item label="Automatically create brand information">
+ <n-switch v-model:value="initAi"></n-switch>
+ </n-form-item>
+ <n-alert v-if="!configurationStatus" type="warning" class="mb-15px" :show-icon="false">
+ <div class="w-100% flex justify-between items-center">
+ <span class="mr-5">To use this feature, you need to integrate an AI model first.</span>
+ <n-button type="primary">Integrate immediately</n-button>
+ </div>
+ </n-alert>
+ <div class="text-[#777]">
+ AI-driven information import automatically analyzes and creates brand information from
+ email domains. After creation, you can modify it at your discretion.
+ </div>
+ <bt-tips style="margin-bottom: 15px">
+ <li>Extract brand and color</li>
+ <li>Analyze content structure</li>
+ <li>Import images and content</li>
+ <li>Use a custom logo (optional)</li>
+ </bt-tips>
+ <n-form-item label="Specify a domain name">
+ <div class="w-100% flex flex-col gap-2.5">
+ <n-input
+ v-for="(_, index) in urls"
+ :key="index"
+ v-model:value="urls[index]"
+ placeholder="">
+ </n-input>
+ <n-button type="primary" ghost @click="addUrl">
+ <template #icon>
+ <i class="i-material-symbols:add-circle-outline"></i>
+ </template>
+ Add more URLs
+ </n-button>
+ </div>
+ </n-form-item>
+ </n-card>
+ </div>
+
+ <!-- <n-card class="my-5">
<div class="switch-settings">
<div class="switch-item">
<div class="label">Track Email Opens</div>
@@ -88,7 +89,7 @@
</div>
</n-card> -->
- <!-- <n-card>
+ <!-- <n-card>
<div class="page-tit mb-5">
<div class="left-tit">
<div class="back-tool">
@@ -111,96 +112,82 @@
</div>
</div>
</n-card> -->
- </div>
+ </div>
</template>
<script setup lang="ts">
-
- import { getDomainDetail, updateDomain } from "../controller/domainConfiguration.controller"
- import { getEditDomainStoreData } from "../store"
- const {
- domainTit,
- quota,
- unit,
- mailboxes,
- catch_email,
- initAi,
- urls,
- configurationStatus
- } = getEditDomainStoreData()
- const route = useRoute()
- const domain = route.params.domain as any
- const uinitOptions = ref([
- {
- label: "B",
- value: "B"
- },
- {
- label: "KB",
- value: "KB"
- },
- {
- label: "MB",
- value: "MB"
- },
- {
- label: "GB",
- value: "GB"
- },
- {
- label: "TB",
- value: "TB"
- },
- ])
-
- getDomainDetail(domain)
-
- /**
- * @description Add url to urls
- */
- function addUrl() {
- urls.value.push("")
- }
-
+import { getDomainDetail } from '../controller/domainConfiguration.controller'
+import { getEditDomainStoreData } from '../store'
+const { domainTit, quota, unit, mailboxes, catch_email, initAi, urls, configurationStatus } =
+ getEditDomainStoreData()
+const route = useRoute()
+const domain = route.params.domain as any
+const uinitOptions = ref([
+ {
+ label: 'B',
+ value: 'B',
+ },
+ {
+ label: 'KB',
+ value: 'KB',
+ },
+ {
+ label: 'MB',
+ value: 'MB',
+ },
+ {
+ label: 'GB',
+ value: 'GB',
+ },
+ {
+ label: 'TB',
+ value: 'TB',
+ },
+])
+
+getDomainDetail(domain)
+
+/**
+ * @description Add url to urls
+ */
+function addUrl() {
+ urls.value.push('')
+}
</script>
<style scoped lang="scss">
- @use "@/styles/index" as base;
- @use "./mixin.scss" as mixin;
-
-
-
- .content-wrapper {
- @include mixin.content-wrapper;
-
- // title
- .page-tit {
- @include mixin.page-tit;
- }
-
- .form-label {
- @include mixin.form-label;
- }
-
- // Switch settings
- .switch-settings {
- @mixin settings-label {
- font-size: 14px;
- font-weight: bold;
- }
-
- .switch-item {
- @include base.row-flex;
- justify-content: space-between;
- margin-bottom: 15px;
-
- .label {
- color: var(--color-text-2);
- @include settings-label()
- }
- }
- }
- }
-
-
-</style>
\ No newline at end of file
+@use '@/styles/index' as base;
+@use './mixin.scss' as mixin;
+
+.content-wrapper {
+ @include mixin.content-wrapper;
+
+ // title
+ .page-tit {
+ @include mixin.page-tit;
+ }
+
+ .form-label {
+ @include mixin.form-label;
+ }
+
+ // Switch settings
+ .switch-settings {
+ @mixin settings-label {
+ font-size: 14px;
+ font-weight: bold;
+ }
+
+ .switch-item {
+ @include base.row-flex;
+ justify-content: space-between;
+ margin-bottom: 15px;
+
+ .label {
+ color: var(--color-text-2);
+ @include settings-label();
+ }
+ }
+ }
+}
+</style>
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/FooterSettings.vue b/core/frontend/src/views/domain/pages/editDomain/components/FooterSettings.vue
index 72db0085..1fe72145 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/FooterSettings.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/FooterSettings.vue
@@ -1,64 +1,60 @@
<template>
- <div class="content-wrapper">
- <n-card class="mb-5">
- <div class="page-tit" style="margin: 0;">
- <div class="left-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
- </div>
- <span class="tit-content">
- Footer Settings
- </span>
- </div>
- </div>
- </n-card>
-
- <n-card>
- <div class="page-tit mb-5">
- <div class="left-tit">
- <span class="tit-content">
- Additional Content
- </span>
- </div>
- </div>
-
- <n-form>
- <n-form-item>
- <template #label><span class="form-label">Copyright Text</span></template>
- <n-input v-model:value="copyright_text"></n-input>
- </n-form-item>
- <n-form-item>
- <template #label><span class="form-label">Disclaimer</span></template>
- <n-input type="textarea" :rows="8" v-model:value="disclaimer"></n-input>
- </n-form-item>
- </n-form>
- </n-card>
- </div>
+ <div class="content-wrapper">
+ <n-card class="mb-5">
+ <div class="page-tit" style="margin: 0">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content"> Footer Settings </span>
+ </div>
+ </div>
+ </n-card>
+
+ <n-card>
+ <div class="page-tit mb-5">
+ <div class="left-tit">
+ <span class="tit-content"> Additional Content </span>
+ </div>
+ </div>
+
+ <n-form>
+ <n-form-item>
+ <template #label><span class="form-label">Copyright Text</span></template>
+ <n-input v-model:value="copyright_text"></n-input>
+ </n-form-item>
+ <n-form-item>
+ <template #label><span class="form-label">Disclaimer</span></template>
+ <n-input v-model:value="disclaimer" type="textarea" :rows="8"></n-input>
+ </n-form-item>
+ </n-form>
+ </n-card>
+ </div>
</template>
<script setup lang="ts">
- import { updateFootersettingsInfo, getFootersettingsInfo } from "../controller/footerSettings.controller"
- import { getEditDomainStoreData } from '../store';
+import { getFootersettingsInfo } from '../controller/footerSettings.controller'
+import { getEditDomainStoreData } from '../store'
- const { copyright_text, disclaimer } = getEditDomainStoreData()
- const route = useRoute()
- const domain = route.params.domain as string
- getFootersettingsInfo(domain)
+const { copyright_text, disclaimer } = getEditDomainStoreData()
+const route = useRoute()
+const domain = route.params.domain as string
+getFootersettingsInfo(domain)
</script>
<style scoped lang="scss">
- @use "@/styles/index" as base;
- @use "./mixin.scss" as mixin;
+@use '@/styles/index' as base;
+@use './mixin.scss' as mixin;
- .content-wrapper {
- @include mixin.content-wrapper;
+.content-wrapper {
+ @include mixin.content-wrapper;
- .page-tit {
- @include mixin.page-tit;
- }
+ .page-tit {
+ @include mixin.page-tit;
+ }
- .form-label {
- @include mixin.form-label;
- }
- }
-</style>
\ No newline at end of file
+ .form-label {
+ @include mixin.form-label;
+ }
+}
+</style>
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/ProjectDetails.vue b/core/frontend/src/views/domain/pages/editDomain/components/ProjectDetails.vue
index 439de3e4..20d8a351 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/ProjectDetails.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/ProjectDetails.vue
@@ -1,459 +1,500 @@
<template>
- <div class="content-wrapper">
- <n-card class="mb-5">
- <div class="page-tit">
- <div class="left-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
- </div>
- <span class="tit-content">
- Project Details
- </span>
- </div>
- </div>
- </n-card>
- <n-card class="mb-5">
- <n-form>
- <n-form-item>
- <template #label><span class="form-label">Project Name</span></template>
- <n-input v-model:value="project_name"></n-input>
- </n-form-item>
- <n-form-item>
- <template #label><span class="form-label">Description</span></template>
- <n-input type="textarea" :rows="7" v-model:value="description"></n-input>
- </n-form-item>
- </n-form>
- </n-card>
-
- <n-card class="mb-5">
- <div class="page-tit mb-20px">
- <div class="left-tit">
- <div class="back-tool">
- <i class="i-ri:earth-fill text-6"></i>
- </div>
- <span class="tit-content">
- Brand Logos
- </span>
- </div>
- </div>
-
- <div class="sub-tit">
- <span class="tit">Logo System</span>
- <span>Upload your brand's logo system to maintain consistent branding across your project</span>
- </div>
-
- <div class="logo-operation">
- <div class="operation-item">
- <div class="operation-tit">Primary Logo</div>
- <div class="operation-sub-tit">Horizontal version for headers</div>
- <div class="logo-area" @click="choosePrimary">
- <div class="upload-logo-placeholder" v-if="!primary_logo">
- <i class="i-carbon:cloud-upload text-8"></i>
- <span>Primary Logo</span>
- </div>
- <n-image :src="primary_logo" height="100" width="150" object-fit="contain" v-else
- preview-disabled>
- <template #error>
- <div class="w-100% h-100% flex justify-center items-center flex-col gap-1.25">
- <i class="i-mingcute:pic-line text-15"></i>
- <span>loading failed</span>
- </div>
- </template>
- </n-image>
- <input type="file" v-show="false" ref="primaryUpload"
- @change="(event) => faviconChange(event, 'primary')">
- </div>
- </div>
- <div class="operation-item">
- <div class="operation-tit">Secondary Logo</div>
- <div class="operation-sub-tit">Vertical/stacked version</div>
- <div class="logo-area" @click="chooseSecondary">
- <div class="upload-logo-placeholder" v-if="!secondary_logo">
- <i class="i-carbon:cloud-upload text-8"></i>
- <span>Primary Logo</span>
- </div>
- <n-image :src="secondary_logo" height="100" width="150" object-fit="contain" v-else
- preview-disabled>
- <template #error>
- <div class="w-100% h-100% flex justify-center items-center flex-col gap-1.25">
- <i class="i-mingcute:pic-line text-15"></i>
- <span>loading failed</span>
- </div>
- </template>
- </n-image>
- <input type="file" v-show="false" ref="secondaryUpload"
- @change="(event) => faviconChange(event, 'secondary')">
- </div>
- </div>
- <div class="operation-item">
- <div class="operation-tit">Favicon</div>
- <div class="operation-sub-tit">Icon for browser tabs</div>
- <div class="logo-area" @click="chooseFavicon">
- <div class="upload-logo-placeholder" v-if="!favicon">
- <i class="i-carbon:cloud-upload text-8"></i>
- <span>Primary Logo</span>
- </div>
- <n-image :src="favicon" height="40" width="60" object-fit="contain" v-else preview-disabled>
- <template #error>
- <div class="w-100% h-100% flex justify-center items-center flex-col gap-1.25">
- <i class="i-mingcute:pic-line text-15"></i>
- <span>loading failed</span>
- </div>
- </template>
- </n-image>
- <input type="file" v-show="false" ref="faviconUpload"
- @change="(event) => faviconChange(event, 'favicon')">
- </div>
- <div class="operation-tools">
- <div class="tool-item">
- <i class="i-carbon:copy text-4"></i>
- </div>
- <div class="tool-item">
- <i class="i-carbon:overflow-menu-vertical text-4"></i>
- </div>
- <div class="tool-item">
- <i class="i-carbon:export text-4"></i>
- </div>
- <div class="tool-item">
- <i class="i-material-symbols:delete-outline text-4"></i>
- </div>
- </div>
- </div>
- </div>
- </n-card>
-
- <n-card>
- <div class="page-tit">
- <div class="left-tit">
- <div class="back-tool">
- <i class="i-ri:earth-fill text-6"></i>
- </div>
- <span class="tit-content">
- Knowledge Base
- </span>
- </div>
-
- <div class="right-tit">
- <n-button @click="knowledgeModalShow = true">New File</n-button>
- </div>
- </div>
-
- <n-card class="mt-5" v-for="(item, index) in knowledge_base" :key="index"
- style="background-color: var(--color-radio-1)">
- <div class="knowledge-box">
- <div class="top-info">
- <div class="info-left">
- <span class="info-tit">{{ item.title }}</span>
- <span class="info-sub-tit">11 days ago</span>
- </div>
- <div class="info-right" @click="handleDelete(item)">
- <i class="i-material-symbols:close-rounded text-5"></i>
- </div>
- </div>
- <div class="operation">
- <n-button type="primary" ghost @click="openEditKnowledge(item)">Edit</n-button>
- <n-button type="primary" ghost @click="previewKnowledgeBaseContent(item)">Preiview</n-button>
- </div>
- </div>
- </n-card>
- </n-card>
- </div>
-
- <!-- Add knowledge base -->
- <n-modal v-model:show="knowledgeModalShow" preset="card" draggable :close-on-esc="false" :mask-closable="false"
- title="New Knowledge File" class="w-150" :on-after-leave="closeKnowledgeModal">
- <n-form>
- <n-form-item label="File Name">
- <n-input v-model:value="knowledgeTitle"></n-input>
- </n-form-item>
- <n-form-item label="Content">
- <n-input type="textarea" :rows="8" v-model:value="knowledgeContent"></n-input>
- </n-form-item>
- </n-form>
-
- <template #footer>
- <div class="flex justify-end gap-5">
- <n-button @click="closeKnowledgeModal">Cancel</n-button>
- <n-button type="primary" @click="createOrUpdateKnowledge"
- :disabled="!knowledgeTitle || !knowledgeContent">Create</n-button>
- </div>
- </template>
- </n-modal>
-
- <!-- Pview knowledge base -->
- <n-modal preset="card" draggable :close-on-esc="false" :mask-closable="false" :title="knowledgeBasePreviewTit"
- class="w-180" v-model:show="knowledgeBasePreview">
- <div class="preview-wrapper">
- <n-scrollbar style="max-height: 700px;">
- <div v-html="mdRes"></div>
- </n-scrollbar>
- </div>
- <template #footer>
- <div class="flex justify-end">
- <n-button>Close</n-button>
- </div>
- </template>
- </n-modal>
-
+ <div class="content-wrapper">
+ <n-card class="mb-5">
+ <div class="page-tit">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content"> Project Details </span>
+ </div>
+ </div>
+ </n-card>
+ <n-card class="mb-5">
+ <n-form>
+ <n-form-item>
+ <template #label><span class="form-label">Project Name</span></template>
+ <n-input v-model:value="project_name"></n-input>
+ </n-form-item>
+ <n-form-item>
+ <template #label><span class="form-label">Description</span></template>
+ <n-input v-model:value="description" type="textarea" :rows="7"></n-input>
+ </n-form-item>
+ </n-form>
+ </n-card>
+
+ <n-card class="mb-5">
+ <div class="page-tit mb-20px">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:earth-fill text-6"></i>
+ </div>
+ <span class="tit-content"> Brand Logos </span>
+ </div>
+ </div>
+
+ <div class="sub-tit">
+ <span class="tit">Logo System</span>
+ <span
+ >Upload your brand's logo system to maintain consistent branding across your project</span
+ >
+ </div>
+
+ <div class="logo-operation">
+ <div class="operation-item">
+ <div class="operation-tit">Primary Logo</div>
+ <div class="operation-sub-tit">Horizontal version for headers</div>
+ <div class="logo-area" @click="choosePrimary">
+ <div v-if="!primary_logo" class="upload-logo-placeholder">
+ <i class="i-carbon:cloud-upload text-8"></i>
+ <span>Primary Logo</span>
+ </div>
+ <n-image
+ v-else
+ :src="primary_logo"
+ height="100"
+ width="150"
+ object-fit="contain"
+ preview-disabled>
+ <template #error>
+ <div class="w-100% h-100% flex justify-center items-center flex-col gap-1.25">
+ <i class="i-mingcute:pic-line text-15"></i>
+ <span>loading failed</span>
+ </div>
+ </template>
+ </n-image>
+ <input
+ v-show="false"
+ ref="primaryUpload"
+ type="file"
+ @change="event => faviconChange(event, 'primary')" />
+ </div>
+ </div>
+ <div class="operation-item">
+ <div class="operation-tit">Secondary Logo</div>
+ <div class="operation-sub-tit">Vertical/stacked version</div>
+ <div class="logo-area" @click="chooseSecondary">
+ <div v-if="!secondary_logo" class="upload-logo-placeholder">
+ <i class="i-carbon:cloud-upload text-8"></i>
+ <span>Primary Logo</span>
+ </div>
+ <n-image
+ v-else
+ :src="secondary_logo"
+ height="100"
+ width="150"
+ object-fit="contain"
+ preview-disabled>
+ <template #error>
+ <div class="w-100% h-100% flex justify-center items-center flex-col gap-1.25">
+ <i class="i-mingcute:pic-line text-15"></i>
+ <span>loading failed</span>
+ </div>
+ </template>
+ </n-image>
+ <input
+ v-show="false"
+ ref="secondaryUpload"
+ type="file"
+ @change="event => faviconChange(event, 'secondary')" />
+ </div>
+ </div>
+ <div class="operation-item">
+ <div class="operation-tit">Favicon</div>
+ <div class="operation-sub-tit">Icon for browser tabs</div>
+ <div class="logo-area" @click="chooseFavicon">
+ <div v-if="!favicon" class="upload-logo-placeholder">
+ <i class="i-carbon:cloud-upload text-8"></i>
+ <span>Primary Logo</span>
+ </div>
+ <n-image
+ v-else
+ :src="favicon"
+ height="40"
+ width="60"
+ object-fit="contain"
+ preview-disabled>
+ <template #error>
+ <div class="w-100% h-100% flex justify-center items-center flex-col gap-1.25">
+ <i class="i-mingcute:pic-line text-15"></i>
+ <span>loading failed</span>
+ </div>
+ </template>
+ </n-image>
+ <input
+ v-show="false"
+ ref="faviconUpload"
+ type="file"
+ @change="event => faviconChange(event, 'favicon')" />
+ </div>
+ <div class="operation-tools">
+ <div class="tool-item">
+ <i class="i-carbon:copy text-4"></i>
+ </div>
+ <div class="tool-item">
+ <i class="i-carbon:overflow-menu-vertical text-4"></i>
+ </div>
+ <div class="tool-item">
+ <i class="i-carbon:export text-4"></i>
+ </div>
+ <div class="tool-item">
+ <i class="i-material-symbols:delete-outline text-4"></i>
+ </div>
+ </div>
+ </div>
+ </div>
+ </n-card>
+
+ <n-card>
+ <div class="page-tit">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:earth-fill text-6"></i>
+ </div>
+ <span class="tit-content"> Knowledge Base </span>
+ </div>
+
+ <div class="right-tit">
+ <n-button @click="knowledgeModalShow = true">New File</n-button>
+ </div>
+ </div>
+
+ <n-card
+ v-for="(item, index) in knowledge_base"
+ :key="index"
+ class="mt-5"
+ style="background-color: var(--color-radio-1)">
+ <div class="knowledge-box">
+ <div class="top-info">
+ <div class="info-left">
+ <span class="info-tit">{{ item.title }}</span>
+ <span class="info-sub-tit">11 days ago</span>
+ </div>
+ <div class="info-right" @click="handleDelete(item)">
+ <i class="i-material-symbols:close-rounded text-5"></i>
+ </div>
+ </div>
+ <div class="operation">
+ <n-button type="primary" ghost @click="openEditKnowledge(item)">Edit</n-button>
+ <n-button type="primary" ghost @click="previewKnowledgeBaseContent(item)">
+ Preview
+ </n-button>
+ </div>
+ </div>
+ </n-card>
+ </n-card>
+ </div>
+
+ <!-- Add knowledge base -->
+ <n-modal
+ v-model:show="knowledgeModalShow"
+ preset="card"
+ draggable
+ :close-on-esc="false"
+ :mask-closable="false"
+ title="New Knowledge File"
+ class="w-150"
+ :on-after-leave="closeKnowledgeModal">
+ <n-form>
+ <n-form-item label="File Name">
+ <n-input v-model:value="knowledgeTitle"></n-input>
+ </n-form-item>
+ <n-form-item label="Content">
+ <n-input v-model:value="knowledgeContent" type="textarea" :rows="8"></n-input>
+ </n-form-item>
+ </n-form>
+
+ <template #footer>
+ <div class="flex justify-end gap-5">
+ <n-button @click="closeKnowledgeModal">Cancel</n-button>
+ <n-button
+ type="primary"
+ :disabled="!knowledgeTitle || !knowledgeContent"
+ @click="createOrUpdateKnowledge">
+ Create
+ </n-button>
+ </div>
+ </template>
+ </n-modal>
+
+ <!-- Preview knowledge base -->
+ <n-modal
+ v-model:show="knowledgeBasePreview"
+ preset="card"
+ draggable
+ :close-on-esc="false"
+ :mask-closable="false"
+ :title="knowledgeBasePreviewTit"
+ class="w-180">
+ <div class="preview-wrapper">
+ <n-scrollbar style="max-height: 700px">
+ <div v-html="mdRes"></div>
+ </n-scrollbar>
+ </div>
+ <template #footer>
+ <div class="flex justify-end">
+ <n-button>Close</n-button>
+ </div>
+ </template>
+ </n-modal>
</template>
<script setup lang="ts">
- import { confirm } from '@/utils';
- import {
- getProjectDetail,
- updateProjectDetail,
- createKnowledgeBase,
- closeKnowledgeModal,
- openEditKnowledge,
- updateKnowledgeBase,
- deleteKnowledgeBase,
- previewKnowledgeBaseContent,
- uploadImage
- } from '../controller/projectDetail.controller';
- import { getEditDomainStoreData } from '../store';
- import { KnowledgeBase } from '../dto';
- import mk from "markdown-it"
- const {
- project_name,
- description,
- industry,
- primary_logo,
- secondary_logo,
- favicon,
- knowledge_base,
- knowledgeModalShow,
- isEditKnowledge,
- knowledgeTitle,
- knowledgeContent,
- knowledge_base_content,
- knowledgeBasePreview,
- knowledgeBasePreviewTit
- } = getEditDomainStoreData()
- const route = useRoute()
- const industryOptions = ref([
- {
- label: "test",
- value: "test"
- }
- ])
- const domain = route.params.domain as string
- const md = mk()
- const mdRes = ref("")
- const faviconUpload = ref()
- const secondaryUpload = ref()
- const primaryUpload = ref()
-
- watch(knowledge_base_content, (val) => {
- mdRes.value = md.render(val)
- })
-
- getProjectDetail(domain)
- /**
- * @description Create or update knowledge
- */
- function createOrUpdateKnowledge() {
- if (isEditKnowledge.value) {
- updateKnowledgeBase(domain)
- } else {
- createKnowledgeBase(domain)
- }
- }
-
- /**
- * @description Delete knowledge base
- */
- function handleDelete(knowledge: KnowledgeBase) {
- confirm({
- title: "Notice",
- content: "Are you sure you want to delete?",
- onConfirm() {
- deleteKnowledgeBase(domain, knowledge)
- }
- })
- }
-
- /**
- * @description Choose favicon file
- */
- function chooseFavicon() {
- faviconUpload.value.click()
- }
-
- /**
- * @description Choose secondary file
- */
- function chooseSecondary(){
- secondaryUpload.value.click()
- }
-
- /**
- * @description Choose primary file
- */
- function choosePrimary(){
- primaryUpload.value.click()
- }
-
- /**
- * @description Favicon file change
- */
- function faviconChange(event: Event, type: string) {
- const file = (event.target as HTMLInputElement).files![0]
- if (!file) return
- const reader = new FileReader();
- reader.onload = async function (event: ProgressEvent<FileReader>) {
- const base64String = event.target?.result as string;
- if (type == "favicon") {
- uploadImage(domain, base64String, file.name, "favicon", "favicon")
- }
-
- if (type == "secondary") {
- uploadImage(domain, base64String, file.name, "secondary logo", "secondary logo")
- }
-
- if (type == "primary") {
- uploadImage(domain, base64String, file.name, "primary logo", "primary logo")
- }
- }
- reader.readAsDataURL(file)
- }
+import mk from 'markdown-it'
+import { confirm } from '@/utils'
+import {
+ getProjectDetail,
+ createKnowledgeBase,
+ closeKnowledgeModal,
+ openEditKnowledge,
+ updateKnowledgeBase,
+ deleteKnowledgeBase,
+ previewKnowledgeBaseContent,
+ uploadImage,
+} from '../controller/projectDetail.controller'
+import { getEditDomainStoreData } from '../store'
+import { KnowledgeBase } from '../dto'
+
+const {
+ project_name,
+ description,
+ primary_logo,
+ secondary_logo,
+ favicon,
+ knowledge_base,
+ knowledgeModalShow,
+ isEditKnowledge,
+ knowledgeTitle,
+ knowledgeContent,
+ knowledge_base_content,
+ knowledgeBasePreview,
+ knowledgeBasePreviewTit,
+} = getEditDomainStoreData()
+
+const route = useRoute()
+
+// const industryOptions = ref([
+// {
+// label: 'test',
+// value: 'test',
+// },
+// ])
+
+const domain = route.params.domain as string
+const md = mk()
+const mdRes = ref('')
+const faviconUpload = ref()
+const secondaryUpload = ref()
+const primaryUpload = ref()
+
+watch(knowledge_base_content, val => {
+ mdRes.value = md.render(val)
+})
+
+getProjectDetail(domain)
+/**
+ * @description Create or update knowledge
+ */
+function createOrUpdateKnowledge() {
+ if (isEditKnowledge.value) {
+ updateKnowledgeBase(domain)
+ } else {
+ createKnowledgeBase(domain)
+ }
+}
+
+/**
+ * @description Delete knowledge base
+ */
+function handleDelete(knowledge: KnowledgeBase) {
+ confirm({
+ title: 'Notice',
+ content: 'Are you sure you want to delete?',
+ onConfirm() {
+ deleteKnowledgeBase(domain, knowledge)
+ },
+ })
+}
+
+/**
+ * @description Choose favicon file
+ */
+function chooseFavicon() {
+ faviconUpload.value.click()
+}
+
+/**
+ * @description Choose secondary file
+ */
+function chooseSecondary() {
+ secondaryUpload.value.click()
+}
+
+/**
+ * @description Choose primary file
+ */
+function choosePrimary() {
+ primaryUpload.value.click()
+}
+
+/**
+ * @description Favicon file change
+ */
+function faviconChange(event: Event, type: string) {
+ const file = (event.target as HTMLInputElement).files![0]
+ if (!file) return
+ const reader = new FileReader()
+ reader.onload = async function (event: ProgressEvent<FileReader>) {
+ const base64String = event.target?.result as string
+ if (type == 'favicon') {
+ uploadImage(domain, base64String, file.name, 'favicon', 'favicon')
+ }
+
+ if (type == 'secondary') {
+ uploadImage(domain, base64String, file.name, 'secondary logo', 'secondary logo')
+ }
+
+ if (type == 'primary') {
+ uploadImage(domain, base64String, file.name, 'primary logo', 'primary logo')
+ }
+ }
+ reader.readAsDataURL(file)
+}
</script>
<style scoped lang="scss">
- @use "@/styles/index" as base;
- @use "./mixin.scss" as mixin;
-
- .content-wrapper {
- @include mixin.content-wrapper;
-
- .page-tit {
- @include mixin.page-tit;
- }
-
- .sub-tit {
- @include base.col-flex-start;
- align-items: flex-start;
- gap: 10px;
- color: var(--color-text-2);
- margin-bottom: 40px;
-
- .tit {
- font-size: 14px;
- font-weight: bold;
- }
- }
-
- .logo-operation {
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: 20px;
-
- .operation-item {
- .operation-tit {
- margin-bottom: 5px;
- font-size: 14px;
- font-weight: bold;
- }
-
- .operation-sub-tit {
- margin-bottom: 15px;
- }
-
- .logo-area {
- width: 100%;
- height: 130px;
- border: 1px solid var(--color-border-1);
- border-radius: 16px;
- margin-bottom: 10px;
- @include base.row-flex;
- justify-content: center;
- align-items: center;
-
- .upload-logo-placeholder {
- @include base.col-flex-center;
- gap: 5px;
- height: 100%;
- }
- }
-
- .operation-tools {
- @include base.row-flex-start;
- gap: 10px;
-
- .tool-item {
- width: 34px;
- height: 34px;
- @include base.row-flex-center;
- background: var(--color-bg-1);
- border: 1px solid var(--color-border-1);
- border-radius: 5px;
- color: var(--color-text-2);
- cursor: pointer;
-
- &:hover {
- background: var(--color-bg-4);
- }
- }
- }
- }
- }
-
- .form-label {
- @include mixin.form-label;
- }
-
- .knowledge-box {
- @include base.col-flex;
- justify-content: flex-start;
- align-items: flex-start;
-
- .top-info {
- width: 100%;
- @include base.row-flex;
- justify-content: space-between;
- align-items: flex-start;
- margin-bottom: 20px;
-
- .info-left {
- @include base.col-flex;
- justify-content: flex-start;
- align-items: flex-start;
-
- .info-tit {
- font-size: 16px;
- font-weight: bold;
- }
- }
-
- .info-right {
- @include base.row-flex-center;
- align-items: center;
- padding: 5px;
- cursor: pointer;
- transition: .15s all ease-in-out;
-
- &:hover {
- background: var(--color-border-2);
- }
- }
- }
-
- .operation {
- @include base.row-flex-start;
- gap: 15px;
- }
- }
- }
-
-
-
+@use '@/styles/index' as base;
+@use './mixin.scss' as mixin;
+
+.content-wrapper {
+ @include mixin.content-wrapper;
+
+ .page-tit {
+ @include mixin.page-tit;
+ }
+
+ .sub-tit {
+ @include base.col-flex-start;
+ align-items: flex-start;
+ gap: 10px;
+ color: var(--color-text-2);
+ margin-bottom: 40px;
+
+ .tit {
+ font-size: 14px;
+ font-weight: bold;
+ }
+ }
+
+ .logo-operation {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 20px;
+
+ .operation-item {
+ .operation-tit {
+ margin-bottom: 5px;
+ font-size: 14px;
+ font-weight: bold;
+ }
+
+ .operation-sub-tit {
+ margin-bottom: 15px;
+ }
+
+ .logo-area {
+ width: 100%;
+ height: 130px;
+ border: 1px solid var(--color-border-1);
+ border-radius: 16px;
+ margin-bottom: 10px;
+ @include base.row-flex;
+ justify-content: center;
+ align-items: center;
+
+ .upload-logo-placeholder {
+ @include base.col-flex-center;
+ gap: 5px;
+ height: 100%;
+ }
+ }
+
+ .operation-tools {
+ @include base.row-flex-start;
+ gap: 10px;
+
+ .tool-item {
+ width: 34px;
+ height: 34px;
+ @include base.row-flex-center;
+ background: var(--color-bg-1);
+ border: 1px solid var(--color-border-1);
+ border-radius: 5px;
+ color: var(--color-text-2);
+ cursor: pointer;
+
+ &:hover {
+ background: var(--color-bg-4);
+ }
+ }
+ }
+ }
+ }
+
+ .form-label {
+ @include mixin.form-label;
+ }
+
+ .knowledge-box {
+ @include base.col-flex;
+ justify-content: flex-start;
+ align-items: flex-start;
+
+ .top-info {
+ width: 100%;
+ @include base.row-flex;
+ justify-content: space-between;
+ align-items: flex-start;
+ margin-bottom: 20px;
+
+ .info-left {
+ @include base.col-flex;
+ justify-content: flex-start;
+ align-items: flex-start;
+
+ .info-tit {
+ font-size: 16px;
+ font-weight: bold;
+ }
+ }
+
+ .info-right {
+ @include base.row-flex-center;
+ align-items: center;
+ padding: 5px;
+ cursor: pointer;
+ transition: 0.15s all ease-in-out;
+
+ &:hover {
+ background: var(--color-border-2);
+ }
+ }
+ }
+
+ .operation {
+ @include base.row-flex-start;
+ gap: 15px;
+ }
+ }
+}
</style>
<style>
- .preview-wrapper {
- max-height: 700px;
-
- img {
- max-width: 100% !important;
- }
- }
-</style>
\ No newline at end of file
+.preview-wrapper {
+ max-height: 700px;
+
+ img {
+ max-width: 100% !important;
+ }
+}
+</style>
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/Sitemap.vue b/core/frontend/src/views/domain/pages/editDomain/components/Sitemap.vue
index 375efd60..44868fb3 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/Sitemap.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/Sitemap.vue
@@ -1,146 +1,148 @@
<template>
- <div class="content-wrapper">
- <n-card class="mb-5">
- <div class="page-tit">
- <div class="left-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
- </div>
- <span class="tit-content">
- Sitemap
- </span>
- </div>
-
- </div>
- </n-card>
-
- <n-card>
- <div v-for="(item, index) in sitemap" :key="index" class="mb-2.5">
- <div class="inline-form-items">
- <n-input v-model:value="item.title" class="name"></n-input>
- <n-input v-model:value="item.uri_path" class="url"></n-input>
- <div class="operation close" v-if="item.isSaved" @click="handleRemove(item, index)">
- <i class="i-material-symbols:close-rounded text-5"></i>
- </div>
- <div v-else
- :class="['operation', { save: item.title && item.uri_path }, { disabled: !item.title || !item.uri_path }]"
- @click="handleSave(item,index)">
- <i class="i-mingcute:save-2-line text-5"></i>
- </div>
- </div>
- </div>
- <div class="mt-5">
- <n-button type="primary" @click="handleAdd">Add link</n-button>
- </div>
- </n-card>
- </div>
+ <div class="content-wrapper">
+ <n-card class="mb-5">
+ <div class="page-tit">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content"> Sitemap </span>
+ </div>
+ </div>
+ </n-card>
+
+ <n-card>
+ <div v-for="(item, index) in sitemap" :key="index" class="mb-2.5">
+ <div class="inline-form-items">
+ <n-input v-model:value="item.title" class="name"></n-input>
+ <n-input v-model:value="item.uri_path" class="url"></n-input>
+ <div v-if="item.isSaved" class="operation close" @click="handleRemove(item, index)">
+ <i class="i-material-symbols:close-rounded text-5"></i>
+ </div>
+ <div
+ v-else
+ :class="[
+ 'operation',
+ { save: item.title && item.uri_path },
+ { disabled: !item.title || !item.uri_path },
+ ]"
+ @click="handleSave(item, index)">
+ <i class="i-mingcute:save-2-line text-5"></i>
+ </div>
+ </div>
+ </div>
+ <div class="mt-5">
+ <n-button type="primary" @click="handleAdd">Add link</n-button>
+ </div>
+ </n-card>
+ </div>
</template>
<script setup lang="ts">
- import { getSitemapInfo, addSitemapInfo, removeSiteMapInfo } from "../controller/sitemap.controller"
- import { getEditDomainStoreData } from "../store"
- import { SiteInfo } from "../dto"
- const { sitemap } = getEditDomainStoreData()
- const route = useRoute()
- const domain = route.params.domain as string
- getSitemapInfo(domain)
-
- /**
- * @description Add site url
- */
- async function handleSave(siteInfo: SiteInfo,index:number) {
- await addSitemapInfo(domain, siteInfo.title, siteInfo.uri_path)
- sitemap.value[index].isSaved = true
- }
-
- /**
- * @description remove site url
- */
- async function handleRemove(siteInfo: SiteInfo, index: number) {
- await removeSiteMapInfo(domain, siteInfo.uri_path)
- sitemap.value.splice(index, 1)
- }
-
- /**
- * @description Add link form
- */
- function handleAdd() {
- sitemap.value.push({
- title: "",
- uri_path: ""
- })
- }
+import { getSitemapInfo, addSitemapInfo, removeSiteMapInfo } from '../controller/sitemap.controller'
+import { getEditDomainStoreData } from '../store'
+import { SiteInfo } from '../dto'
+const { sitemap } = getEditDomainStoreData()
+const route = useRoute()
+const domain = route.params.domain as string
+getSitemapInfo(domain)
+
+/**
+ * @description Add site url
+ */
+async function handleSave(siteInfo: SiteInfo, index: number) {
+ await addSitemapInfo(domain, siteInfo.title, siteInfo.uri_path)
+ sitemap.value[index].isSaved = true
+}
+
+/**
+ * @description remove site url
+ */
+async function handleRemove(siteInfo: SiteInfo, index: number) {
+ await removeSiteMapInfo(domain, siteInfo.uri_path)
+ sitemap.value.splice(index, 1)
+}
+
+/**
+ * @description Add link form
+ */
+function handleAdd() {
+ sitemap.value.push({
+ title: '',
+ uri_path: '',
+ })
+}
</script>
<style scoped lang="scss">
- @use "@/styles/index" as base;
- @use "./mixin.scss" as mixin;
-
- .content-wrapper {
- @include mixin.content-wrapper;
-
- .page-tit {
- @include mixin.page-tit;
- }
-
- .form-label {
- @include mixin.form-label;
- }
-
- .inline-form-items {
- @include base.row-flex;
- width: 100%;
- justify-content: space-between;
- gap: 10px;
-
- .name {
- flex: 3.5;
- }
-
- .url {
- flex: 3.5;
- }
-
- .type {
- flex: 2;
- }
-
- .operation {
- width: 34px;
- height: 34px;
- @include base.row-flex-center;
- background: var(--color-bg-1);
- border: 1px solid var(--color-border-1);
- border-radius: 5px;
- color: var(--color-text-2);
- transition: .2s all ease-in-out;
- cursor: pointer;
-
- &.close {
- border-color: var(--color-error-1);
- color: var(--color-error-1);
- }
-
- &.close:hover {
- color: #fff;
- background: var(--color-error-1);
- }
-
- &.save {
- color: var(--color-primary-1);
- border-color: var(--color-primary-1);
- }
-
- &.save:hover {
- color: #fff;
- background: var(--color-primary-hover-1);
- }
-
- &.disabled {
- opacity: 0.5;
- cursor: not-allowed;
- }
- }
- }
- }
-</style>
\ No newline at end of file
+@use '@/styles/index' as base;
+@use './mixin.scss' as mixin;
+
+.content-wrapper {
+ @include mixin.content-wrapper;
+
+ .page-tit {
+ @include mixin.page-tit;
+ }
+
+ .form-label {
+ @include mixin.form-label;
+ }
+
+ .inline-form-items {
+ @include base.row-flex;
+ width: 100%;
+ justify-content: space-between;
+ gap: 10px;
+
+ .name {
+ flex: 3.5;
+ }
+
+ .url {
+ flex: 3.5;
+ }
+
+ .type {
+ flex: 2;
+ }
+
+ .operation {
+ width: 34px;
+ height: 34px;
+ @include base.row-flex-center;
+ background: var(--color-bg-1);
+ border: 1px solid var(--color-border-1);
+ border-radius: 5px;
+ color: var(--color-text-2);
+ transition: 0.2s all ease-in-out;
+ cursor: pointer;
+
+ &.close {
+ border-color: var(--color-error-1);
+ color: var(--color-error-1);
+ }
+
+ &.close:hover {
+ color: #fff;
+ background: var(--color-error-1);
+ }
+
+ &.save {
+ color: var(--color-primary-1);
+ border-color: var(--color-primary-1);
+ }
+
+ &.save:hover {
+ color: #fff;
+ background: var(--color-primary-hover-1);
+ }
+
+ &.disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+ }
+ }
+}
+</style>
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/Styling.vue b/core/frontend/src/views/domain/pages/editDomain/components/Styling.vue
index 699a9c9d..169a64ee 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/Styling.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/Styling.vue
@@ -1,201 +1,213 @@
<template>
- <div class="content-wrapper">
- <n-card class="mb-5">
- <div class="page-tit mb-5">
- <div class="left-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
- </div>
- <span class="tit-content">
- Color Palette
- </span>
- </div>
- </div>
- <n-form>
- <n-form-item>
- <template #label><span class="form-label">Accent Color</span></template>
- <div class="flex justify-between gap-2.5 w-100%">
- <n-color-picker style="width: 50px;" :modes="['hex', 'rgb', 'hsl', 'hsv']"
- :render-label="colorRenderLabel" v-model:value="accent_color"></n-color-picker>
- <n-input v-model:value="accent_color"></n-input>
- </div>
- </n-form-item>
- <n-form-item>
- <template #label><span class="form-label">Text Color</span></template>
- <div class="flex justify-between gap-2.5 w-100%">
- <n-color-picker style="width: 50px;" :modes="['hex', 'rgb', 'hsl', 'hsv']"
- :render-label="colorRenderLabel" v-model:value="text_color"></n-color-picker>
- <n-input v-model:value="text_color"></n-input>
- </div>
- </n-form-item>
- <n-form-item>
- <template #label><span class="form-label">Page Background</span></template>
- <div class="flex justify-between gap-2.5 w-100%">
- <n-color-picker style="width: 50px;" :modes="['hex', 'rgb', 'hsl', 'hsv']"
- :render-label="colorRenderLabel" v-model:value="page_background"></n-color-picker>
- <n-input v-model:value="page_background"></n-input>
- </div>
- </n-form-item>
- <n-form-item>
- <template #label><span class="form-label">Container Background</span></template>
- <div class="flex justify-between gap-2.5 w-100%">
- <n-color-picker style="width: 50px;" :modes="['hex', 'rgb', 'hsl', 'hsv']"
- :render-label="colorRenderLabel" v-model:value="container_background"></n-color-picker>
- <n-input v-model:value="container_background"></n-input>
- </div>
- </n-form-item>
- <n-form-item>
- <template #label><span class="form-label">Link footer color</span></template>
- <div class="flex justify-between gap-2.5 w-100%">
- <n-color-picker style="width: 50px;" :modes="['hex', 'rgb', 'hsl', 'hsv']"
- :render-label="colorRenderLabel" v-model:value="link_footer_color"></n-color-picker>
- <n-input v-model:value="link_footer_color"></n-input>
- </div>
- </n-form-item>
- <n-form-item>
- <template #label><span class="form-label">Link social color</span></template>
- <div class="flex justify-between gap-2.5 w-100%">
- <n-color-picker style="width: 50px;" :modes="['hex', 'rgb', 'hsl', 'hsv']"
- :render-label="colorRenderLabel" v-model:value="link_social_color"></n-color-picker>
- <n-input v-model:value="link_social_color"></n-input>
- </div>
- </n-form-item>
- </n-form>
- </n-card>
-
-
- <n-card class="mb-5">
- <div class="page-tit mb-5">
- <div class="left-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
- </div>
- <span class="tit-content">
- Typography
- </span>
- </div>
- </div>
- <n-form>
- <n-form-item>
- <template #label><span class="form-label">Heading Font</span></template>
- <n-input v-model:value="heading_font"></n-input>
- </n-form-item>
-
- <n-card class="form-desc">
- <div class="container">
- <div class="form-label">Preview:</div>
- <div class="desc" :style="{ fontFamily: heading_font }">The quick brown fox jumps over the lazy
- dog
- </div>
- </div>
- </n-card>
- </n-form>
-
- <n-form class="mt-5">
- <n-form-item>
- <template #label><span class="form-label">Body Font</span></template>
- <n-input v-model:value="body_font"></n-input>
- </n-form-item>
-
- <n-card class="form-desc">
- <div class="container">
- <div class="form-label">Preview:</div>
- <div class="desc" :style="{ fontFamily: body_font }">The quick brown fox jumps over the lazy dog
- </div>
- </div>
- </n-card>
- </n-form>
- </n-card>
-
-
- <n-card>
- <div class="attention">
- <div class="attention-tit">Typography Guidelines:</div>
- <div class="attention-item">Use web-safe fonts for better compatibility</div>
- <div class="attention-item">Always include fallback fonts for better performance</div>
- </div>
- </n-card>
- </div>
+ <div class="content-wrapper">
+ <n-card class="mb-5">
+ <div class="page-tit mb-5">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content"> Color Palette </span>
+ </div>
+ </div>
+ <n-form>
+ <n-form-item>
+ <template #label><span class="form-label">Accent Color</span></template>
+ <div class="flex justify-between gap-2.5 w-100%">
+ <n-color-picker
+ v-model:value="accent_color"
+ style="width: 50px"
+ :modes="['hex', 'rgb', 'hsl', 'hsv']"
+ :render-label="colorRenderLabel"></n-color-picker>
+ <n-input v-model:value="accent_color"></n-input>
+ </div>
+ </n-form-item>
+ <n-form-item>
+ <template #label><span class="form-label">Text Color</span></template>
+ <div class="flex justify-between gap-2.5 w-100%">
+ <n-color-picker
+ v-model:value="text_color"
+ style="width: 50px"
+ :modes="['hex', 'rgb', 'hsl', 'hsv']"
+ :render-label="colorRenderLabel"></n-color-picker>
+ <n-input v-model:value="text_color"></n-input>
+ </div>
+ </n-form-item>
+ <n-form-item>
+ <template #label><span class="form-label">Page Background</span></template>
+ <div class="flex justify-between gap-2.5 w-100%">
+ <n-color-picker
+ v-model:value="page_background"
+ style="width: 50px"
+ :modes="['hex', 'rgb', 'hsl', 'hsv']"
+ :render-label="colorRenderLabel"></n-color-picker>
+ <n-input v-model:value="page_background"></n-input>
+ </div>
+ </n-form-item>
+ <n-form-item>
+ <template #label><span class="form-label">Container Background</span></template>
+ <div class="flex justify-between gap-2.5 w-100%">
+ <n-color-picker
+ v-model:value="container_background"
+ style="width: 50px"
+ :modes="['hex', 'rgb', 'hsl', 'hsv']"
+ :render-label="colorRenderLabel"></n-color-picker>
+ <n-input v-model:value="container_background"></n-input>
+ </div>
+ </n-form-item>
+ <n-form-item>
+ <template #label><span class="form-label">Link footer color</span></template>
+ <div class="flex justify-between gap-2.5 w-100%">
+ <n-color-picker
+ v-model:value="link_footer_color"
+ style="width: 50px"
+ :modes="['hex', 'rgb', 'hsl', 'hsv']"
+ :render-label="colorRenderLabel"></n-color-picker>
+ <n-input v-model:value="link_footer_color"></n-input>
+ </div>
+ </n-form-item>
+ <n-form-item>
+ <template #label><span class="form-label">Link social color</span></template>
+ <div class="flex justify-between gap-2.5 w-100%">
+ <n-color-picker
+ v-model:value="link_social_color"
+ style="width: 50px"
+ :modes="['hex', 'rgb', 'hsl', 'hsv']"
+ :render-label="colorRenderLabel"></n-color-picker>
+ <n-input v-model:value="link_social_color"></n-input>
+ </div>
+ </n-form-item>
+ </n-form>
+ </n-card>
+
+ <n-card class="mb-5">
+ <div class="page-tit mb-5">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content"> Typography </span>
+ </div>
+ </div>
+ <n-form>
+ <n-form-item>
+ <template #label><span class="form-label">Heading Font</span></template>
+ <n-input v-model:value="heading_font"></n-input>
+ </n-form-item>
+
+ <n-card class="form-desc">
+ <div class="container">
+ <div class="form-label">Preview:</div>
+ <div class="desc" :style="{ fontFamily: heading_font }">
+ The quick brown fox jumps over the lazy dog
+ </div>
+ </div>
+ </n-card>
+ </n-form>
+
+ <n-form class="mt-5">
+ <n-form-item>
+ <template #label><span class="form-label">Body Font</span></template>
+ <n-input v-model:value="body_font"></n-input>
+ </n-form-item>
+
+ <n-card class="form-desc">
+ <div class="container">
+ <div class="form-label">Preview:</div>
+ <div class="desc" :style="{ fontFamily: body_font }">
+ The quick brown fox jumps over the lazy dog
+ </div>
+ </div>
+ </n-card>
+ </n-form>
+ </n-card>
+
+ <n-card>
+ <div class="attention">
+ <div class="attention-tit">Typography Guidelines:</div>
+ <div class="attention-item">Use web-safe fonts for better compatibility</div>
+ <div class="attention-item">Always include fallback fonts for better performance</div>
+ </div>
+ </n-card>
+ </div>
</template>
<script setup lang="tsx">
- import { getStylingInfo, updateStyleingInfo } from '../controller/styleing.controller'
- import { getEditDomainStoreData } from '../store'
- const {
- accent_color,
- text_color,
- link_footer_color,
- link_social_color,
- page_background,
- container_background,
- heading_font,
- body_font,
- } = getEditDomainStoreData()
- const route = useRoute()
- const domain = route.params.domain as string
- getStylingInfo(domain)
-
-
- function colorRenderLabel() {
- return ""
- }
+import { getStylingInfo } from '../controller/styleing.controller'
+import { getEditDomainStoreData } from '../store'
+const {
+ accent_color,
+ text_color,
+ link_footer_color,
+ link_social_color,
+ page_background,
+ container_background,
+ heading_font,
+ body_font,
+} = getEditDomainStoreData()
+const route = useRoute()
+const domain = route.params.domain as string
+getStylingInfo(domain)
+
+function colorRenderLabel() {
+ return ''
+}
</script>
<style scoped lang="scss">
- @use "@/styles/index" as base;
- @use "./mixin.scss" as mixin;
-
- .content-wrapper {
- @include mixin.content-wrapper;
-
- .page-tit {
- @include mixin.page-tit;
- }
-
- .form-label {
- @include mixin.form-label;
- }
-
- .sub-tit {
- color: var(--color-text-1);
- }
-
- .form-desc {
- border: 1px solid var(--color-border-1);
-
- .container {
- @include base.col-flex-start;
- align-items: flex-start;
- gap: 10px;
-
- .desc {
- color: var(--color-text-1);
- font-size: 14px;
- }
- }
- }
-
- .attention {
- .attention-tit {
- margin-bottom: 10px;
- }
-
- .attention-item {
- padding-left: 10px;
- position: relative;
-
- &::before {
- content: "";
- display: block;
- width: 4px;
- height: 4px;
- background: var(--color-text-2);
- border-radius: 50%;
- position: absolute;
- left: 0;
- top: 7px;
- }
- }
- }
- }
-</style>
\ No newline at end of file
+@use '@/styles/index' as base;
+@use './mixin.scss' as mixin;
+
+.content-wrapper {
+ @include mixin.content-wrapper;
+
+ .page-tit {
+ @include mixin.page-tit;
+ }
+
+ .form-label {
+ @include mixin.form-label;
+ }
+
+ .sub-tit {
+ color: var(--color-text-1);
+ }
+
+ .form-desc {
+ border: 1px solid var(--color-border-1);
+
+ .container {
+ @include base.col-flex-start;
+ align-items: flex-start;
+ gap: 10px;
+
+ .desc {
+ color: var(--color-text-1);
+ font-size: 14px;
+ }
+ }
+ }
+
+ .attention {
+ .attention-tit {
+ margin-bottom: 10px;
+ }
+
+ .attention-item {
+ padding-left: 10px;
+ position: relative;
+
+ &::before {
+ content: '';
+ display: block;
+ width: 4px;
+ height: 4px;
+ background: var(--color-text-2);
+ border-radius: 50%;
+ position: absolute;
+ left: 0;
+ top: 7px;
+ }
+ }
+ }
+}
+</style>
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/Typography.vue b/core/frontend/src/views/domain/pages/editDomain/components/Typography.vue
index 0a45007e..c2f101ce 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/Typography.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/Typography.vue
@@ -1,128 +1,123 @@
<template>
- <div class="content-wrapper">
- <n-card class="mb-5">
- <div class="page-tit" style="margin: 0;">
- <div class="left-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
- </div>
- <span class="tit-content">
- Typography
- </span>
- </div>
- </div>
- </n-card>
-
- <n-card class="mb-5">
- <n-form>
- <n-form-item>
- <template #label><span class="form-label">Heading Font</span></template>
- <n-input v-model:value="heading_font"></n-input>
- </n-form-item>
-
- <n-card class="form-desc">
- <div class="container">
- <div class="form-label">Preview:</div>
- <div class="desc" :style="{ fontFamily: heading_font }">The quick brown fox jumps over the lazy
- dog
- </div>
- </div>
- </n-card>
- </n-form>
- </n-card>
-
- <n-card class="mb-5">
- <n-form>
- <n-form-item>
- <template #label><span class="form-label">Body Font</span></template>
- <n-input v-model:value="body_font"></n-input>
- </n-form-item>
-
- <n-card class="form-desc">
- <div class="container">
- <div class="form-label">Preview:</div>
- <div class="desc" :style="{ fontFamily: body_font }">The quick brown fox jumps over the lazy dog
- </div>
- </div>
- </n-card>
- </n-form>
- </n-card>
-
- <n-card>
- <div class="attention">
- <div class="attention-tit">Typography Guidelines:</div>
- <div class="attention-item">Use web-safe fonts for better compatibility</div>
- <div class="attention-item">Always include fallback fonts for better performance</div>
- </div>
- </n-card>
- </div>
+ <div class="content-wrapper">
+ <n-card class="mb-5">
+ <div class="page-tit" style="margin: 0">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content"> Typography </span>
+ </div>
+ </div>
+ </n-card>
+
+ <n-card class="mb-5">
+ <n-form>
+ <n-form-item>
+ <template #label><span class="form-label">Heading Font</span></template>
+ <n-input v-model:value="heading_font"></n-input>
+ </n-form-item>
+
+ <n-card class="form-desc">
+ <div class="container">
+ <div class="form-label">Preview:</div>
+ <div class="desc" :style="{ fontFamily: heading_font }">
+ The quick brown fox jumps over the lazy dog
+ </div>
+ </div>
+ </n-card>
+ </n-form>
+ </n-card>
+
+ <n-card class="mb-5">
+ <n-form>
+ <n-form-item>
+ <template #label><span class="form-label">Body Font</span></template>
+ <n-input v-model:value="body_font"></n-input>
+ </n-form-item>
+
+ <n-card class="form-desc">
+ <div class="container">
+ <div class="form-label">Preview:</div>
+ <div class="desc" :style="{ fontFamily: body_font }">
+ The quick brown fox jumps over the lazy dog
+ </div>
+ </div>
+ </n-card>
+ </n-form>
+ </n-card>
+
+ <n-card>
+ <div class="attention">
+ <div class="attention-tit">Typography Guidelines:</div>
+ <div class="attention-item">Use web-safe fonts for better compatibility</div>
+ <div class="attention-item">Always include fallback fonts for better performance</div>
+ </div>
+ </n-card>
+ </div>
</template>
<script setup lang="ts">
- import { updateTypography } from "../controller/typography.controller"
- import { getEditDomainStoreData } from '../store';
-
- const {
- heading_font,
- body_font,
- } = getEditDomainStoreData()
- const route = useRoute()
- const domain = route.params.domain as string
+// import { updateTypography } from '../controller/typography.controller'
+import { getEditDomainStoreData } from '../store'
+
+const { heading_font, body_font } = getEditDomainStoreData()
+
+// const route = useRoute()
+// const domain = route.params.domain as string
</script>
<style scoped lang="scss">
- @use "@/styles/index" as base;
- @use "./mixin.scss" as mixin;
-
-
- .content-wrapper {
- @include mixin.content-wrapper;
-
- .page-tit {
- @include mixin.page-tit;
- }
-
- .form-label {
- @include mixin.form-label;
- }
-
- .form-desc {
- border: 1px solid var(--color-border-1);
-
- .container {
- @include base.col-flex-start;
- align-items: flex-start;
- gap: 10px;
-
- .desc {
- color: var(--color-text-1);
- font-size: 14px;
- }
- }
- }
-
- .attention {
- .attention-tit {
- margin-bottom: 10px;
- }
-
- .attention-item {
- padding-left: 10px;
- position: relative;
-
- &::before {
- content: "";
- display: block;
- width: 4px;
- height: 4px;
- background: var(--color-text-2);
- border-radius: 50%;
- position: absolute;
- left: 0;
- top: 7px;
- }
- }
- }
-
- }
-</style>
\ No newline at end of file
+@use '@/styles/index' as base;
+@use './mixin.scss' as mixin;
+
+.content-wrapper {
+ @include mixin.content-wrapper;
+
+ .page-tit {
+ @include mixin.page-tit;
+ }
+
+ .form-label {
+ @include mixin.form-label;
+ }
+
+ .form-desc {
+ border: 1px solid var(--color-border-1);
+
+ .container {
+ @include base.col-flex-start;
+ align-items: flex-start;
+ gap: 10px;
+
+ .desc {
+ color: var(--color-text-1);
+ font-size: 14px;
+ }
+ }
+ }
+
+ .attention {
+ .attention-tit {
+ margin-bottom: 10px;
+ }
+
+ .attention-item {
+ padding-left: 10px;
+ position: relative;
+
+ &::before {
+ content: '';
+ display: block;
+ width: 4px;
+ height: 4px;
+ background: var(--color-text-2);
+ border-radius: 50%;
+ position: absolute;
+ left: 0;
+ top: 7px;
+ }
+ }
+ }
+}
+</style>
diff --git a/core/frontend/src/views/domain/pages/editDomain/controller/projectDetail.controller.ts b/core/frontend/src/views/domain/pages/editDomain/controller/projectDetail.controller.ts
index c1ee812c..3ddbf42d 100644
--- a/core/frontend/src/views/domain/pages/editDomain/controller/projectDetail.controller.ts
+++ b/core/frontend/src/views/domain/pages/editDomain/controller/projectDetail.controller.ts
@@ -1,156 +1,190 @@
-import { getEditDomainStoreData } from "../store";
-import { instance } from "@/api";
-import { instanceOptions } from "./companyProfile.controller"
-import { KnowledgeBase } from "../dto";
+import { getEditDomainStoreData } from '../store'
+import { instance } from '@/api'
+import { instanceOptions } from './companyProfile.controller'
+import { KnowledgeBase } from '../dto'
/**
* @description Get project detail
*/
export async function getProjectDetail(domainStr: string, noOption?: boolean) {
- const { project_name, primary_logo, favicon, industry, description, secondary_logo, hasGotProjectDetail, knowledge_base } = getEditDomainStoreData()
- if (hasGotProjectDetail.value) return
- try {
- const res = await instance.post("/askai/project/get_base_info", { domain: domainStr }, noOption ? {} : instanceOptions) as Record<string, any>
- project_name.value = res.project_name;
- primary_logo.value = res.primary_logo;
- favicon.value = res.favicon;
- industry.value = res.industry;
- description.value = res.description;
- secondary_logo.value = res.secondary_logo;
- knowledge_base.value = res.knowledge_base
- hasGotProjectDetail.value = true
- } catch (error) {
- console.warn(error)
- }
+ const {
+ project_name,
+ primary_logo,
+ favicon,
+ industry,
+ description,
+ secondary_logo,
+ hasGotProjectDetail,
+ knowledge_base,
+ } = getEditDomainStoreData()
+ if (hasGotProjectDetail.value) return
+ try {
+ const res = (await instance.post(
+ '/askai/project/get_base_info',
+ { domain: domainStr },
+ noOption ? {} : instanceOptions
+ )) as Record<string, any>
+ project_name.value = res.project_name
+ primary_logo.value = res.primary_logo
+ favicon.value = res.favicon
+ industry.value = res.industry
+ description.value = res.description
+ secondary_logo.value = res.secondary_logo
+ knowledge_base.value = res.knowledge_base
+ hasGotProjectDetail.value = true
+ } catch (error) {
+ console.warn(error)
+ }
}
/**
* @description Update project detail
*/
export async function updateProjectDetail(domainStr: string) {
- const { project_name, primary_logo, favicon, industry, description, secondary_logo } = getEditDomainStoreData()
- try {
- await instance.post("/askai/project/modify_base_info", {
- domain: domainStr,
- project_name: project_name.value,
- primary_logo: primary_logo.value,
- favicon: favicon.value,
- industry: industry.value,
- description: description.value,
- secondary_logo: secondary_logo.value,
- }, instanceOptions)
- } catch (error) {
- console.warn(error)
- }
+ const { project_name, primary_logo, favicon, industry, description, secondary_logo } =
+ getEditDomainStoreData()
+ try {
+ await instance.post(
+ '/askai/project/modify_base_info',
+ {
+ domain: domainStr,
+ project_name: project_name.value,
+ primary_logo: primary_logo.value,
+ favicon: favicon.value,
+ industry: industry.value,
+ description: description.value,
+ secondary_logo: secondary_logo.value,
+ },
+ instanceOptions
+ )
+ } catch (error) {
+ console.warn(error)
+ }
}
/**
* @description Create knowledge base
*/
export async function createKnowledgeBase(domain: string) {
- try {
- const { knowledgeTitle, knowledgeContent, hasGotProjectDetail } = getEditDomainStoreData()
- await instance.post("/askai/project/create_knowledge_base_file", {
- domain,
- title: knowledgeTitle.value,
- content: knowledgeContent.value
- }, instanceOptions) as Record<string, any>
- hasGotProjectDetail.value = false
- await getProjectDetail(domain, true)
- closeKnowledgeModal()
- } catch (error) {
- console.warn(error)
- }
+ try {
+ const { knowledgeTitle, knowledgeContent, hasGotProjectDetail } = getEditDomainStoreData()
+ ;(await instance.post(
+ '/askai/project/create_knowledge_base_file',
+ {
+ domain,
+ title: knowledgeTitle.value,
+ content: knowledgeContent.value,
+ },
+ instanceOptions
+ )) as Record<string, any>
+ hasGotProjectDetail.value = false
+ await getProjectDetail(domain, true)
+ closeKnowledgeModal()
+ } catch (error) {
+ console.warn(error)
+ }
}
/**
* @description Update knowledge base
*/
export async function updateKnowledgeBase(domain: string) {
- const { activeKnowledge, hasGotProjectDetail, knowledgeTitle, knowledgeContent } = getEditDomainStoreData()
- try {
- await instance.post("/askai/project/modify_knowledge_base_file", {
- domain,
- title: knowledgeTitle.value,
- content: knowledgeContent.value,
- kid: activeKnowledge.value.kid
- })
- hasGotProjectDetail.value = false
- await getProjectDetail(domain, true)
- closeKnowledgeModal()
- } catch (error) {
- console.warn(error)
- }
+ const { activeKnowledge, hasGotProjectDetail, knowledgeTitle, knowledgeContent } =
+ getEditDomainStoreData()
+ try {
+ await instance.post('/askai/project/modify_knowledge_base_file', {
+ domain,
+ title: knowledgeTitle.value,
+ content: knowledgeContent.value,
+ kid: activeKnowledge.value.kid,
+ })
+ hasGotProjectDetail.value = false
+ await getProjectDetail(domain, true)
+ closeKnowledgeModal()
+ } catch (error) {
+ console.warn(error)
+ }
}
/**
* @description Close knowledge modal
*/
export function closeKnowledgeModal() {
- const { knowledgeContent, knowledgeTitle, knowledgeModalShow, isEditKnowledge } = getEditDomainStoreData()
- knowledgeContent.value = ""
- knowledgeTitle.value = ""
- knowledgeModalShow.value = false
- isEditKnowledge.value = false
+ const { knowledgeContent, knowledgeTitle, knowledgeModalShow, isEditKnowledge } =
+ getEditDomainStoreData()
+ knowledgeContent.value = ''
+ knowledgeTitle.value = ''
+ knowledgeModalShow.value = false
+ isEditKnowledge.value = false
}
/**
* @description Open edit knowledge modal
*/
export function openEditKnowledge(knowledge: KnowledgeBase) {
- const {
- knowledgeTitle,
- knowledgeContent,
- knowledgeModalShow,
- activeKnowledge,
- isEditKnowledge,
- } = getEditDomainStoreData()
+ const { knowledgeTitle, knowledgeContent, knowledgeModalShow, activeKnowledge, isEditKnowledge } =
+ getEditDomainStoreData()
- activeKnowledge.value = knowledge
- knowledgeTitle.value = knowledge.title
- knowledgeContent.value = knowledge.content
- knowledgeModalShow.value = true
- isEditKnowledge.value = true
+ activeKnowledge.value = knowledge
+ knowledgeTitle.value = knowledge.title
+ knowledgeContent.value = knowledge.content
+ knowledgeModalShow.value = true
+ isEditKnowledge.value = true
}
/**
* @description Delete knowledge base
*/
export async function deleteKnowledgeBase(domain: string, knowledge: KnowledgeBase) {
- const { hasGotProjectDetail } = getEditDomainStoreData()
- try {
- await instance.post("/askai/project/remove_knowledge_base_file", { domain, kid: knowledge.kid }, instanceOptions)
- hasGotProjectDetail.value = false
- getProjectDetail(domain, true)
- } catch (error) {
- console.warn(error)
- }
+ const { hasGotProjectDetail } = getEditDomainStoreData()
+ try {
+ await instance.post(
+ '/askai/project/remove_knowledge_base_file',
+ { domain, kid: knowledge.kid },
+ instanceOptions
+ )
+ hasGotProjectDetail.value = false
+ getProjectDetail(domain, true)
+ } catch (error) {
+ console.warn(error)
+ }
}
/**
* @description Preview knowledge base content
*/
export function previewKnowledgeBaseContent(knowledge_base: KnowledgeBase) {
- const { knowledge_base_content, knowledgeBasePreview, knowledgeBasePreviewTit } = getEditDomainStoreData()
- knowledgeBasePreview.value = true
- knowledge_base_content.value = knowledge_base.content
- knowledgeBasePreviewTit.value = knowledge_base.title
+ const { knowledge_base_content, knowledgeBasePreview, knowledgeBasePreviewTit } =
+ getEditDomainStoreData()
+ knowledgeBasePreview.value = true
+ knowledge_base_content.value = knowledge_base.content
+ knowledgeBasePreviewTit.value = knowledge_base.title
}
/**
* @description Upload image
*/
-export async function uploadImage(domain: string, image: string, filename: string, alt_text: string, image_tag: string) {
- try {
- const res = await instance.post("/askai/project/upload_image", {
- domain,
- image,
- filename,
- alt_text,
- image_tag
- }, instanceOptions)
- console.log(res)
- } catch (error) {
- console.warn((error))
- return ""
- }
-}
\ No newline at end of file
+export async function uploadImage(
+ domain: string,
+ image: string,
+ filename: string,
+ alt_text: string,
+ image_tag: string
+) {
+ try {
+ const res = await instance.post(
+ '/askai/project/upload_image',
+ {
+ domain,
+ image,
+ filename,
+ alt_text,
+ image_tag,
+ },
+ instanceOptions
+ )
+ console.log(res)
+ } catch (error) {
+ console.warn(error)
+ return ''
+ }
+}
diff --git a/core/frontend/src/views/domain/pages/editDomain/index.vue b/core/frontend/src/views/domain/pages/editDomain/index.vue
index 25a23556..e6d09e60 100644
--- a/core/frontend/src/views/domain/pages/editDomain/index.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/index.vue
@@ -11,19 +11,21 @@
<!-- Content tabs -->
<div class="content-tabs">
- <div v-for="(item, index) in menuList" :key="index" :class="['tab-item', { active: activeTab == item }]"
+ <div
+ v-for="(item, index) in menuList"
+ :key="index"
+ :class="['tab-item', { active: activeTab == item }]"
@click="activeTab = item">
<span>{{ item }}</span>
</div>
</div>
<div class="dynamic-content">
- <n-scrollbar style="height: 100%;">
+ <n-scrollbar style="height: 100%">
<component :is="contentMap.get(activeTab)" />
</n-scrollbar>
</div>
-
- <div class="footer-tool" v-if="activeTab !== 'Sitemap'">
+ <div v-if="activeTab !== 'Sitemap'" class="footer-tool">
<n-button type="primary" @click="switchHanldeSave">
<template #icon>
<i class="i-mingcute:save-2-line text-5"></i>
@@ -35,159 +37,163 @@
</template>
<script setup lang="ts">
- import { updateDomain } from "./controller/domainConfiguration.controller"
- import { updateProjectDetail } from "./controller/projectDetail.controller"
- import { updateCompanyProfile } from "./controller/companyProfile.controller"
- import { updateStyleingInfo } from "./controller/styleing.controller"
- import { updateTypography } from "./controller/typography.controller"
- // import {} from "./controller/sitemap.controller"
- import { updateFootersettingsInfo } from "./controller/footerSettings.controller"
- import { updateAisettingsInfo } from "./controller/aiSettings.controller"
- const DomainConfiguration = defineAsyncComponent(() => import("./components/DomainConfiguration.vue"))
- const ProjectDetails = defineAsyncComponent(() => import("./components/ProjectDetails.vue"))
- const CompanyProile = defineAsyncComponent(() => import("./components/CompanyProfile.vue"))
- const Styling = defineAsyncComponent(() => import("./components/Styling.vue"))
- const Typography = defineAsyncComponent(() => import("./components/Typography.vue"))
- const Sitemap = defineAsyncComponent(() => import("./components/Sitemap.vue"))
- const FooterSettings = defineAsyncComponent(() => import("./components/FooterSettings.vue"))
- const AISettings = defineAsyncComponent(() => import("./components/AISettings.vue"))
- const menuList = ref([
- "Domain Configuration",
- "Project Details",
- "Company Profile",
- "Styling",
- "Sitemap",
- "Footer Settings",
- "AI Settings"
- ])
- const activeTab = ref("Domain Configuration")
- const contentMap = new Map([
- ["Domain Configuration", DomainConfiguration],
- ["Project Details", ProjectDetails],
- ["Company Profile", CompanyProile],
- ["Styling", Styling],
- ["Sitemap", Sitemap],
- ["Footer Settings", FooterSettings],
- ["AI Settings", AISettings],
- ])
- const route = useRoute()
- const domain = route.params.domain as string
-
- /**
- * @description Switch for handle save
- */
- function switchHanldeSave() {
- switch (activeTab.value) {
- case "Domain Configuration":
- updateDomain()
- break;
- case "Project Details":
- updateProjectDetail(domain)
- break;
- case "Company Profile":
- updateCompanyProfile(domain)
- break;
- case "Styling":
- updateStyleingInfo(domain)
- break;
- case "Typography":
- updateTypography(domain)
- break;
- case "Sitemap":
- break;
- case "Footer Settings":
- updateFootersettingsInfo(domain)
- break;
- case "AI Settings":
- updateAisettingsInfo(domain)
- break
- }
+import { updateDomain } from './controller/domainConfiguration.controller'
+import { updateProjectDetail } from './controller/projectDetail.controller'
+import { updateCompanyProfile } from './controller/companyProfile.controller'
+import { updateStyleingInfo } from './controller/styleing.controller'
+import { updateTypography } from './controller/typography.controller'
+// import {} from "./controller/sitemap.controller"
+import { updateFootersettingsInfo } from './controller/footerSettings.controller'
+import { updateAisettingsInfo } from './controller/aiSettings.controller'
+
+const DomainConfiguration = defineAsyncComponent(
+ () => import('./components/DomainConfiguration.vue')
+)
+const ProjectDetails = defineAsyncComponent(() => import('./components/ProjectDetails.vue'))
+const CompanyProile = defineAsyncComponent(() => import('./components/CompanyProfile.vue'))
+const Styling = defineAsyncComponent(() => import('./components/Styling.vue'))
+// const Typography = defineAsyncComponent(() => import('./components/Typography.vue'))
+const Sitemap = defineAsyncComponent(() => import('./components/Sitemap.vue'))
+const FooterSettings = defineAsyncComponent(() => import('./components/FooterSettings.vue'))
+const AISettings = defineAsyncComponent(() => import('./components/AISettings.vue'))
+
+const menuList = ref([
+ 'Domain Configuration',
+ 'Project Details',
+ 'Company Profile',
+ 'Styling',
+ 'Sitemap',
+ 'Footer Settings',
+ 'AI Settings',
+])
+const activeTab = ref('Domain Configuration')
+const contentMap = new Map([
+ ['Domain Configuration', DomainConfiguration],
+ ['Project Details', ProjectDetails],
+ ['Company Profile', CompanyProile],
+ ['Styling', Styling],
+ ['Sitemap', Sitemap],
+ ['Footer Settings', FooterSettings],
+ ['AI Settings', AISettings],
+])
+const route = useRoute()
+const domain = route.params.domain as string
+
+/**
+ * @description Switch for handle save
+ */
+function switchHanldeSave() {
+ switch (activeTab.value) {
+ case 'Domain Configuration':
+ updateDomain()
+ break
+ case 'Project Details':
+ updateProjectDetail(domain)
+ break
+ case 'Company Profile':
+ updateCompanyProfile(domain)
+ break
+ case 'Styling':
+ updateStyleingInfo(domain)
+ break
+ case 'Typography':
+ updateTypography(domain)
+ break
+ case 'Sitemap':
+ break
+ case 'Footer Settings':
+ updateFootersettingsInfo(domain)
+ break
+ case 'AI Settings':
+ updateAisettingsInfo(domain)
+ break
}
+}
</script>
<style scoped lang="scss">
- @use '@/styles/index' as base;
-
- .wrapper {
- display: grid;
- grid-template-rows: 40px 45px 1fr 80px;
- height: calc(100% - 48px);
- box-sizing: border-box;
- padding: 24px;
- }
-
- .footer-tool {
- position: absolute;
- bottom: 0px;
- left: 0;
- background: #fff;
- width: 100%;
- height: 80px;
- @include base.row-flex;
- justify-content: flex-start;
- align-items: center;
- padding: 0 20px;
- }
-
- // page title
- .page-tit {
+@use '@/styles/index' as base;
+
+.wrapper {
+ display: grid;
+ grid-template-rows: 40px 45px 1fr 80px;
+ height: calc(100% - 48px);
+ box-sizing: border-box;
+ padding: 24px;
+}
+
+.footer-tool {
+ position: absolute;
+ bottom: 0px;
+ left: 0;
+ background: #fff;
+ width: 100%;
+ height: 80px;
+ @include base.row-flex;
+ justify-content: flex-start;
+ align-items: center;
+ padding: 0 20px;
+}
+
+// page title
+.page-tit {
+ @include base.row-flex-start;
+ margin-bottom: 20px;
+ gap: 15px;
+
+ .back-tool {
+ color: var(--color-primary-1);
@include base.row-flex-start;
- margin-bottom: 20px;
- gap: 15px;
+ gap: 5px;
+ cursor: pointer;
+ @include base.transition-all;
- .back-tool {
- color: var(--color-primary-1);
- @include base.row-flex-start;
- gap: 5px;
- cursor: pointer;
- @include base.transition-all;
-
- &:hover {
- color: var(--color-primary-3);
- }
-
- .back-btn {
- font-size: 18px;
- }
+ &:hover {
+ color: var(--color-primary-3);
}
- .tit-content {
+ .back-btn {
font-size: 18px;
- color: var(--color-text-1);
- font-weight: bold;
}
}
- // Content tabs
- .content-tabs {
- width: 100%;
- height: 46px;
- border-bottom: 1px solid var(--color-border-1);
- @include base.row-flex-start;
+ .tit-content {
+ font-size: 18px;
+ color: var(--color-text-1);
+ font-weight: bold;
+ }
+}
+
+// Content tabs
+.content-tabs {
+ width: 100%;
+ height: 46px;
+ border-bottom: 1px solid var(--color-border-1);
+ @include base.row-flex-start;
+
+ .tab-item {
+ height: 100%;
+ @include base.col-flex-center;
+ font-size: 14px;
+ padding: 0 20px;
+ cursor: pointer;
+ transition: 0.1s color ease-in-out;
- .tab-item {
- height: 100%;
- @include base.col-flex-center;
- font-size: 14px;
- padding: 0 20px;
- cursor: pointer;
- transition: 0.1s color ease-in-out;
-
- &:hover {
- color: var(--color-primary-1);
- }
-
- &.active {
- border-bottom: 2px solid var(--color-primary-1);
- margin-bottom: -2px;
- }
+ &:hover {
+ color: var(--color-primary-1);
}
- }
- // Dynamic content
- .dynamic-content {
- height: calc(100vh - 240px);
- box-sizing: border-box;
- padding: 20px;
+ &.active {
+ border-bottom: 2px solid var(--color-primary-1);
+ margin-bottom: -2px;
+ }
}
+}
+
+// Dynamic content
+.dynamic-content {
+ height: calc(100vh - 240px);
+ box-sizing: border-box;
+ padding: 20px;
+}
</style>
diff --git a/core/frontend/src/views/market/task/components/FromSelect.vue b/core/frontend/src/views/market/task/components/FromSelect.vue
index b2e350b7..fdfc1c75 100644
--- a/core/frontend/src/views/market/task/components/FromSelect.vue
+++ b/core/frontend/src/views/market/task/components/FromSelect.vue
@@ -12,6 +12,7 @@
v-model:value="sender"
:loading="loading"
:options="senderOptions"
+ :filterable="true"
@update:value="handleUpdateSender">
</n-select>
</div>
diff --git a/core/frontend/src/views/settings/ai-model/components/AddModel.vue b/core/frontend/src/views/settings/ai-model/components/AddModel.vue
index 2166e814..f227a18c 100644
--- a/core/frontend/src/views/settings/ai-model/components/AddModel.vue
+++ b/core/frontend/src/views/settings/ai-model/components/AddModel.vue
@@ -1,99 +1,112 @@
<template>
- <n-modal preset="card" draggable :close-on-esc="false" :mask-closable="false" title="Add Model" class="w-100"
- v-model:show="show">
- <n-form :model="addModelFormData" :rules="rules" ref="addModelFormRef">
- <n-form-item label="模型ID" path="modelId">
- <n-input v-model:value="addModelFormData.modelId"></n-input>
- </n-form-item>
- <n-form-item label="模型别名" path="title">
- <n-input v-model:value="addModelFormData.title"></n-input>
- </n-form-item>
- <n-form-item label="模型功能" path="capability">
- <n-select :options="modelCapabilities" multiple v-model:value="addModelFormData.capability"></n-select>
- </n-form-item>
- <n-form-item label="最大上下文长度" path="max_tokens">
- <n-input-number v-model:value="addModelFormData.max_tokens" class="w-100%"></n-input-number>
- </n-form-item>
- </n-form>
- <template #footer>
- <div class="flex justify-end gap-5">
- <n-button @click="close">Cancel</n-button>
- <n-button type="primary" @click="confirmAddModel(store)">Confirm</n-button>
- </div>
- </template>
- </n-modal>
+ <n-modal
+ v-model:show="show"
+ preset="card"
+ draggable
+ :close-on-esc="false"
+ :mask-closable="false"
+ title="Add Model"
+ class="w-100">
+ <n-form ref="addModelFormRef" :model="addModelFormData" :rules="rules">
+ <n-form-item label="模型ID" path="modelId">
+ <n-input v-model:value="addModelFormData.modelId"></n-input>
+ </n-form-item>
+ <n-form-item label="模型别名" path="title">
+ <n-input v-model:value="addModelFormData.title"></n-input>
+ </n-form-item>
+ <n-form-item label="模型功能" path="capability">
+ <n-select v-model:value="addModelFormData.capability" :options="modelCapabilities" multiple>
+ </n-select>
+ </n-form-item>
+ <n-form-item label="最大上下文长度" path="max_tokens">
+ <n-input-number v-model:value="addModelFormData.max_tokens" class="w-100%"></n-input-number>
+ </n-form-item>
+ </n-form>
+ <template #footer>
+ <div class="flex justify-end gap-5">
+ <n-button @click="close">Cancel</n-button>
+ <n-button type="primary" @click="confirmAddModel(store)">Confirm</n-button>
+ </div>
+ </template>
+ </n-modal>
</template>
<script setup lang="ts">
- import type { SelectOption } from "naive-ui"
- import { ModelStore } from "../dto"
- import { confirmAddModel } from "../controller"
- const store = inject<ModelStore>("modelStore")!
- const { addModelFormData, addModelFormRef } = store
- const show = ref(false)
- const modelCapabilities: SelectOption[] = [
- {
- label: "llm",
- value: "llm"
- },
- {
- label: "vision",
- value: "vision"
- },
- {
- label: "tools",
- value: "tools"
- },
- {
- label: "text-to-image",
- value: "text-to-image"
- },
- ]
- const rules = {
- modelId: [{ required: true, message: "modelId is required", trigger: "blur" }],
- title: [{ required: true, message: "title is required", trigger: "blur" }],
- capability: [{
- validator(_: any, value: any, callback: any) {
- if (value.length) {
- return true
- } else {
- return new Error("capability is required")
- }
- }, trigger: "blur"
- }],
- max_tokens: [{
- validator(_: any, value: any, callback: any) {
- if (value) {
- return true
- } else {
- return new Error("max_tokens is required")
- }
- }, trigger: "blur"
- }],
- }
+import type { SelectOption } from 'naive-ui'
+import { ModelStore } from '../dto'
+import { confirmAddModel } from '../controller'
+const store = inject<ModelStore>('modelStore')!
+const { addModelFormData, addModelFormRef } = store
+const show = ref(false)
+const modelCapabilities: SelectOption[] = [
+ {
+ label: 'llm',
+ value: 'llm',
+ },
+ {
+ label: 'vision',
+ value: 'vision',
+ },
+ {
+ label: 'tools',
+ value: 'tools',
+ },
+ {
+ label: 'text-to-image',
+ value: 'text-to-image',
+ },
+]
+const rules = {
+ modelId: [{ required: true, message: 'modelId is required', trigger: 'blur' }],
+ title: [{ required: true, message: 'title is required', trigger: 'blur' }],
+ capability: [
+ {
+ validator(_: any, value: any) {
+ if (value.length) {
+ return true
+ } else {
+ return new Error('capability is required')
+ }
+ },
+ trigger: 'blur',
+ },
+ ],
+ max_tokens: [
+ {
+ validator(_: any, value: any) {
+ if (value) {
+ return true
+ } else {
+ return new Error('max_tokens is required')
+ }
+ },
+ trigger: 'blur',
+ },
+ ],
+}
- /***
- * @description Open modal
- */
- function open() {
- show.value = true
- }
+/***
+ * @description Open modal
+ */
+function open() {
+ show.value = true
+}
- /**
- * @description Close modal
- */
- function close() {
- show.value = false
- addModelFormData.value.capability = []
- addModelFormData.value.max_tokens = 0
- addModelFormData.value.modelId = ""
- addModelFormData.value.title = ""
- }
+/**
+ * @description Close modal
+ */
+function close() {
+ show.value = false
+ addModelFormData.value.capability = []
+ addModelFormData.value.max_tokens = 0
+ addModelFormData.value.modelId = ''
+ addModelFormData.value.title = ''
+}
- defineExpose({
- open,
- close
- })
+defineExpose({
+ open,
+ close,
+})
</script>
-<style scoped></style>
\ No newline at end of file
+<style scoped></style>
diff --git a/core/frontend/src/views/settings/ai-model/components/AddProvider.vue b/core/frontend/src/views/settings/ai-model/components/AddProvider.vue
index 0deadc76..13e46f39 100644
--- a/core/frontend/src/views/settings/ai-model/components/AddProvider.vue
+++ b/core/frontend/src/views/settings/ai-model/components/AddProvider.vue
@@ -1,63 +1,66 @@
<template>
- <n-modal preset="card" v-model:show="show" :close-on-esc="false" :mask-closable="false" draggable class="w-150"
- title="Add Provider">
- <n-form :model="addProviderFormData" :rules="rules" ref="addProviderFormDataRef">
- <n-form-item label="供应商标题" path="supplierTitle">
- <n-input v-model:value="addProviderFormData.supplierTitle"></n-input>
- </n-form-item>
- <n-form-item label="供应商名称" path="supplierName">
- <n-input v-model:value="addProviderFormData.supplierName"></n-input>
- </n-form-item>
- <n-form-item label="接口地址" path="baseUrl">
- <n-input v-model:value="addProviderFormData.baseUrl"></n-input>
- </n-form-item>
- <n-form-item label="密钥" path="apiKey">
- <n-input v-model:value="addProviderFormData.apiKey"></n-input>
- </n-form-item>
- </n-form>
- <template #footer>
- <div class="flex justify-end gap-5">
- <n-button>Cancel</n-button>
- <n-button type="primary" @click="confirmAddProvider(store)">Confirm</n-button>
- </div>
- </template>
- </n-modal>
+ <n-modal
+ v-model:show="show"
+ preset="card"
+ :close-on-esc="false"
+ :mask-closable="false"
+ draggable
+ class="w-150"
+ title="Add Provider">
+ <n-form ref="addProviderFormDataRef" :model="addProviderFormData" :rules="rules">
+ <n-form-item label="供应商标题" path="supplierTitle">
+ <n-input v-model:value="addProviderFormData.supplierTitle"></n-input>
+ </n-form-item>
+ <n-form-item label="供应商名称" path="supplierName">
+ <n-input v-model:value="addProviderFormData.supplierName"></n-input>
+ </n-form-item>
+ <n-form-item label="接口地址" path="baseUrl">
+ <n-input v-model:value="addProviderFormData.baseUrl"></n-input>
+ </n-form-item>
+ <n-form-item label="密钥" path="apiKey">
+ <n-input v-model:value="addProviderFormData.apiKey"></n-input>
+ </n-form-item>
+ </n-form>
+ <template #footer>
+ <div class="flex justify-end gap-5">
+ <n-button>Cancel</n-button>
+ <n-button type="primary" @click="confirmAddProvider(store)">Confirm</n-button>
+ </div>
+ </template>
+ </n-modal>
</template>
<script setup lang="ts">
- import { confirmAddProvider } from "../controller"
- import { ModelStore } from '../dto';
- const store = inject<ModelStore>("modelStore")!
- const { addProviderFormData, addProviderFormDataRef } = store
- const show = ref(false)
- const rules = {
- supplierTitle: [{ required: true, message: "supplierTitle is required", trigger: "blur" }],
- supplierName: [{ required: true, message: "supplierName is required", trigger: "blur" }],
- baseUrl: [{ required: true, message: "baseUrl is required", trigger: "blur" }],
- apiKey: [{ required: true, message: "apiKey is required", trigger: "blur" }],
- }
+import { confirmAddProvider } from '../controller'
+import { ModelStore } from '../dto'
+const store = inject<ModelStore>('modelStore')!
+const { addProviderFormData, addProviderFormDataRef } = store
+const show = ref(false)
+const rules = {
+ supplierTitle: [{ required: true, message: 'supplierTitle is required', trigger: 'blur' }],
+ supplierName: [{ required: true, message: 'supplierName is required', trigger: 'blur' }],
+ baseUrl: [{ required: true, message: 'baseUrl is required', trigger: 'blur' }],
+ apiKey: [{ required: true, message: 'apiKey is required', trigger: 'blur' }],
+}
+/**
+ * @description Open modal
+ */
+function open() {
+ show.value = true
+}
+/**
+ * @description Close modal
+ */
+function close() {
+ show.value = false
+}
-
- /**
- * @description Open modal
- */
- function open() {
- show.value = true
- }
-
- /**
- * @description Close modal
- */
- function close() {
- show.value = false
- }
-
- defineExpose({
- open,
- close
- })
+defineExpose({
+ open,
+ close,
+})
</script>
-<style scoped></style>
\ No newline at end of file
+<style scoped></style>
diff --git a/core/frontend/src/views/settings/ai-model/components/ModelManager.vue b/core/frontend/src/views/settings/ai-model/components/ModelManager.vue
index 6484af68..168502f2 100644
--- a/core/frontend/src/views/settings/ai-model/components/ModelManager.vue
+++ b/core/frontend/src/views/settings/ai-model/components/ModelManager.vue
@@ -1,311 +1,314 @@
<template>
- <!-- <n-modal preset="card" draggable :close-on-esc="false" :mask-closable="false" title="Model manager"
+ <!-- <n-modal preset="card" draggable :close-on-esc="false" :mask-closable="false" title="Model manager"
class="w-180 customer-modal" segmented v-model:show="show"> -->
- <div class="manager-wrapper">
- <!-- Provider list -->
- <div class="left-provider">
- <div class="provider-list">
- <div :class="['provider-item', { active: item.supplierName == currentProvider?.supplierName }]"
- v-for="item in providerList" :key="item.supplierName" @click="getModelListBySupplier(item)">
- <div class="item-icon">
- <n-image :src="item.icon" v-if="item.icon" height="24" width="24"></n-image>
- <i class="i-ai:big-model w-6.5 h-6.5" v-else></i>
- </div>
- <span class="tit">{{ item.supplierTitle }}</span>
- </div>
- </div>
- <div class="add-privider">
- <n-button @click="handleAddProvider">
- <template #icon>
- <i class="i-ic:baseline-add-circle"></i>
- </template>
- Add model service provider
- </n-button>
- </div>
- </div>
-
- <!-- Configuration -->
- <n-spin :show="configurationLoading">
- <div class="right-configuration">
- <div class="top-switch">
- <div class="switch-info">
- <i class="i-ic:baseline-error text-5"></i>
- <span class="tit">DeepSeek</span>
- <n-switch v-model:value="currentProvider.status"
- @update:value="status => changeProviderStatus(status, modelStore)"></n-switch>
- </div>
- <i class="i-ri:delete-bin-3-line text-5.5 hover:text-red-5 cursor-pointer"
- @click="removeProvider(modelStore)"></i>
- </div>
- <div class="center-api">
- <n-form class="mt-15px">
- <n-form-item label="API密钥">
- <div class="w-100%">
- <n-input-group>
- <n-input v-model:value="currentProvider.apiKey"></n-input>
- <n-button @click="checkProviderApiConfiguration(modelStore)">检查</n-button>
- </n-input-group>
- <n-button text type="info" class="mt-5px"
- @click="getProviderConfiguration(modelStore)">点击获取密钥</n-button>
- </div>
- </n-form-item>
- <n-form-item label="API地址">
- <div class="w-100%">
- <n-input v-model:value="currentProvider.baseUrl"></n-input>
- <span class="text-[var(--color-text-3)] mt-5">示例: https://api.deepseek.com/v1</span>
- </div>
- </n-form-item>
- </n-form>
- <n-button type="primary" @click="setProviderConfiguration(modelStore)">保存API</n-button>
- </div>
- <div class="bottom-model-list">
- <div class="header-tit">
- <div>
- <span class="tit">模型</span>
- <span class="sub-tit">默认从/models获取所有模型</span>
- </div>
- <!-- <div class="add-model" @click="handleAddModel">
+ <div class="manager-wrapper">
+ <!-- Provider list -->
+ <div class="left-provider">
+ <div class="provider-list">
+ <div
+ v-for="item in providerList"
+ :key="item.supplierName"
+ :class="['provider-item', { active: item.supplierName == currentProvider?.supplierName }]"
+ @click="getModelListBySupplier(item)">
+ <div class="item-icon">
+ <n-image v-if="item.icon" :src="item.icon" height="24" width="24"></n-image>
+ <i v-else class="i-ai:big-model w-6.5 h-6.5"></i>
+ </div>
+ <span class="tit">{{ item.supplierTitle }}</span>
+ </div>
+ </div>
+ <div class="add-privider">
+ <n-button @click="handleAddProvider">
+ <template #icon>
+ <i class="i-ic:baseline-add-circle"></i>
+ </template>
+ Add model service provider
+ </n-button>
+ </div>
+ </div>
+
+ <!-- Configuration -->
+ <n-spin :show="configurationLoading">
+ <div class="right-configuration">
+ <div class="top-switch">
+ <div class="switch-info">
+ <i class="i-ic:baseline-error text-5"></i>
+ <span class="tit">DeepSeek</span>
+ <n-switch
+ v-model:value="currentProvider.status"
+ @update:value="status => changeProviderStatus(status, modelStore)"></n-switch>
+ </div>
+ <i
+ class="i-ri:delete-bin-3-line text-5.5 hover:text-red-5 cursor-pointer"
+ @click="removeProvider(modelStore)"></i>
+ </div>
+ <div class="center-api">
+ <n-form class="mt-15px">
+ <n-form-item label="API密钥">
+ <div class="w-100%">
+ <n-input-group>
+ <n-input v-model:value="currentProvider.apiKey"></n-input>
+ <n-button @click="checkProviderApiConfiguration(modelStore)">检查</n-button>
+ </n-input-group>
+ <n-button
+ text
+ type="info"
+ class="mt-5px"
+ @click="getProviderConfiguration(modelStore)"
+ >点击获取密钥</n-button
+ >
+ </div>
+ </n-form-item>
+ <n-form-item label="API地址">
+ <div class="w-100%">
+ <n-input v-model:value="currentProvider.baseUrl"></n-input>
+ <span class="text-[var(--color-text-3)] mt-5"
+ >示例: https://api.deepseek.com/v1</span
+ >
+ </div>
+ </n-form-item>
+ </n-form>
+ <n-button type="primary" @click="setProviderConfiguration(modelStore)">保存API</n-button>
+ </div>
+ <div class="bottom-model-list">
+ <div class="header-tit">
+ <div>
+ <span class="tit">模型</span>
+ <span class="sub-tit">默认从/models获取所有模型</span>
+ </div>
+ <!-- <div class="add-model" @click="handleAddModel">
<i class="i-ic:baseline-control-point text-4"></i>
<span class="tit">新建模型</span>
</div> -->
- </div>
- <div class="model-list" v-for="item in modelList" :key="item.title">
- <div class="model-item">
- <!-- <i class="i-ic:round-check-circle-outline text-5"></i> -->
- <span class="model-name">{{ item.title }}</span>
- <div class="operation">
- <n-switch v-model:value="item.status"
- @update:value="status => setModelStatus(item.modelId, status, modelStore)"></n-switch>
- </div>
- </div>
- </div>
- </div>
- </div>
- </n-spin>
- </div>
-
-
- <!-- Add Provider -->
- <AddProvider ref="addProviderRef" />
-
- <!-- Add Model -->
- <AddModel ref="addModelRef" />
-
+ </div>
+ <div v-for="item in modelList" :key="item.title" class="model-list">
+ <div class="model-item">
+ <!-- <i class="i-ic:round-check-circle-outline text-5"></i> -->
+ <span class="model-name">{{ item.title }}</span>
+ <div class="operation">
+ <n-switch
+ v-model:value="item.status"
+ @update:value="
+ status => setModelStatus(item.modelId, status, modelStore)
+ "></n-switch>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </n-spin>
+ </div>
+
+ <!-- Add Provider -->
+ <AddProvider ref="addProviderRef" />
+
+ <!-- Add Model -->
+ <AddModel ref="addModelRef" />
</template>
<script setup lang="ts">
- import AddProvider from './AddProvider.vue';
- import AddModel from './AddModel.vue';
- import { ModelStore, Provider } from '../dto';
- import {
- getModelList,
- getProviderList,
- getProviderConfiguration,
- changeProviderStatus,
- checkProviderApiConfiguration,
- setProviderConfiguration,
- setModelStatus,
- removeProvider
- } from "../controller"
- const modelStore = inject<ModelStore>("modelStore")!
- const {
- providerList,
- modelList,
- currentProvider,
- configurationLoading,
- addProviderRef,
- addModelRef
- } = modelStore
- getProviderList(modelStore)
-
-
- /**
- * @description Get model list
- */
- function getModelListBySupplier(provider: Provider) {
- currentProvider.value = provider
- getModelList(provider.supplierName, modelStore)
- }
-
- /**
- * @description Handle add provider
- */
- function handleAddProvider() {
- addProviderRef.value.open()
- }
-
- /**
- * @description Handle add model
- */
- function handleAddModel() {
- addModelRef.value.open()
- }
-
+import AddProvider from './AddProvider.vue'
+import AddModel from './AddModel.vue'
+import { ModelStore, Provider } from '../dto'
+import {
+ getModelList,
+ getProviderList,
+ getProviderConfiguration,
+ changeProviderStatus,
+ checkProviderApiConfiguration,
+ setProviderConfiguration,
+ setModelStatus,
+ removeProvider,
+} from '../controller'
+const modelStore = inject<ModelStore>('modelStore')!
+const {
+ providerList,
+ modelList,
+ currentProvider,
+ configurationLoading,
+ addProviderRef,
+ addModelRef,
+} = modelStore
+getProviderList(modelStore)
+
+/**
+ * @description Get model list
+ */
+function getModelListBySupplier(provider: Provider) {
+ currentProvider.value = provider
+ getModelList(provider.supplierName, modelStore)
+}
+
+/**
+ * @description Handle add provider
+ */
+function handleAddProvider() {
+ addProviderRef.value.open()
+}
+
+/**
+ * @description Handle add model
+ */
+// function handleAddModel() {
+// addModelRef.value.open()
+// }
</script>
<style scoped lang="scss">
- @use "@/styles/index.scss" as base;
+@use '@/styles/index.scss' as base;
- .manager-wrapper {
- // height: 480px;
- display: grid;
- grid-template-columns: 230px 1fr;
- /* border-top: 1px solid var(--color-border-2);
+.manager-wrapper {
+ // height: 480px;
+ display: grid;
+ grid-template-columns: 230px 1fr;
+ /* border-top: 1px solid var(--color-border-2);
border-bottom: 1px solid var(--color-border-2); */
- .left-provider {
- height: 100%;
- display: grid;
- grid-template-rows: 1fr 60px;
- border-right: 1px solid var(--color-border-2);
-
- .provider-list {
- @include base.col-flex;
- gap: 0;
-
- .provider-item {
- height: 50px;
- width: 100%;
- box-sizing: border-box;
- padding-left: 10px;
- border-bottom: 1px solid var(--color-border-1);
- @include base.row-flex-start;
- gap: 5px;
- align-items: center;
- transition: .15s all ease-in-out;
- cursor: pointer;
-
- .tit {
- font-size: 14px;
- font-weight: bold;
- }
-
- &:hover {
- background: #eef9ee;
- }
-
- &.active {
- background: #eef9ee;
- }
-
- .item-icon {
- width: 32px;
- @include base.row-flex-center;
- }
- }
-
- }
-
- .add-privider {
- @include base.row-flex-center;
-
- }
- }
-
- .right-configuration {
- padding: 0 15px 15px;
-
- .top-switch {
- height: 50px;
- @include base.row-flex;
- align-items: center;
- justify-content: space-between;
- border-bottom: 1px solid var(--color-border-2);
-
- .switch-info {
- @include base.row-flex-start;
- align-items: center;
- gap: 5px;
-
- .tit {
- font-size: 14px;
- font-weight: bold;
- }
- }
- }
-
- .center-api {
- padding-bottom: 15px;
- border-bottom: 1px solid var(--color-border-2);
- }
-
- .bottom-model-list {
- margin-top: 15px;
-
- .header-tit {
- @include base.row-flex;
- justify-content: space-between;
- margin-bottom: 15px;
-
- .tit {
- font-weight: bold;
- font-size: 14px;
- margin-right: 5px;
- }
-
- .sub-tit {
- color: var(--color-text-3);
- }
-
- .add-model {
- @include base.row-flex-start;
- gap: 5px;
- align-items: center;
- cursor: pointer;
-
- .tit {
- font-size: 14px;
- }
- }
- }
-
- .model-list {
- @include base.col-flex;
- justify-content: flex-start;
-
-
- .model-item {
- @include base.row-flex;
- justify-content: space-between;
- width: 100%;
- align-items: center;
- padding: 10px 5px;
- transition: .15s all ease-in-out;
- cursor: pointer;
-
- i.active {
- color: var(--color-primary-1);
- }
-
- .model-name {
- font-weight: bold;
- font-size: 14px;
- }
-
- &:hover {
- background: #eef9ee;
- }
-
- .operation {
- @include base.row-flex-start;
- gap: 10px;
- }
-
- }
- }
- }
- }
- }
-
-
-
-
+ .left-provider {
+ height: 100%;
+ display: grid;
+ grid-template-rows: 1fr 60px;
+ border-right: 1px solid var(--color-border-2);
+
+ .provider-list {
+ @include base.col-flex;
+ gap: 0;
+
+ .provider-item {
+ height: 50px;
+ width: 100%;
+ box-sizing: border-box;
+ padding-left: 10px;
+ border-bottom: 1px solid var(--color-border-1);
+ @include base.row-flex-start;
+ gap: 5px;
+ align-items: center;
+ transition: 0.15s all ease-in-out;
+ cursor: pointer;
+
+ .tit {
+ font-size: 14px;
+ font-weight: bold;
+ }
+
+ &:hover {
+ background: #eef9ee;
+ }
+
+ &.active {
+ background: #eef9ee;
+ }
+
+ .item-icon {
+ width: 32px;
+ @include base.row-flex-center;
+ }
+ }
+ }
+
+ .add-privider {
+ @include base.row-flex-center;
+ }
+ }
+
+ .right-configuration {
+ padding: 0 15px 15px;
+
+ .top-switch {
+ height: 50px;
+ @include base.row-flex;
+ align-items: center;
+ justify-content: space-between;
+ border-bottom: 1px solid var(--color-border-2);
+
+ .switch-info {
+ @include base.row-flex-start;
+ align-items: center;
+ gap: 5px;
+
+ .tit {
+ font-size: 14px;
+ font-weight: bold;
+ }
+ }
+ }
+
+ .center-api {
+ padding-bottom: 15px;
+ border-bottom: 1px solid var(--color-border-2);
+ }
+
+ .bottom-model-list {
+ margin-top: 15px;
+
+ .header-tit {
+ @include base.row-flex;
+ justify-content: space-between;
+ margin-bottom: 15px;
+
+ .tit {
+ font-weight: bold;
+ font-size: 14px;
+ margin-right: 5px;
+ }
+
+ .sub-tit {
+ color: var(--color-text-3);
+ }
+
+ .add-model {
+ @include base.row-flex-start;
+ gap: 5px;
+ align-items: center;
+ cursor: pointer;
+
+ .tit {
+ font-size: 14px;
+ }
+ }
+ }
+
+ .model-list {
+ @include base.col-flex;
+ justify-content: flex-start;
+
+ .model-item {
+ @include base.row-flex;
+ justify-content: space-between;
+ width: 100%;
+ align-items: center;
+ padding: 10px 5px;
+ transition: 0.15s all ease-in-out;
+ cursor: pointer;
+
+ i.active {
+ color: var(--color-primary-1);
+ }
+
+ .model-name {
+ font-weight: bold;
+ font-size: 14px;
+ }
+
+ &:hover {
+ background: #eef9ee;
+ }
+
+ .operation {
+ @include base.row-flex-start;
+ gap: 10px;
+ }
+ }
+ }
+ }
+ }
+}
</style>
<style>
- .customer-modal {
- .n-card__content {
- padding: 0 !important;
- }
- }
-</style>
\ No newline at end of file
+.customer-modal {
+ .n-card__content {
+ padding: 0 !important;
+ }
+}
+</style>
diff --git a/core/frontend/src/views/template/components/CreateTplModal.vue b/core/frontend/src/views/template/components/CreateTplModal.vue
index deac0f8c..ac85df3c 100644
--- a/core/frontend/src/views/template/components/CreateTplModal.vue
+++ b/core/frontend/src/views/template/components/CreateTplModal.vue
@@ -1,152 +1,165 @@
<template>
- <n-modal v-model:show="show" preset="card" draggable :close-on-esc="false" :mask-closable="false" segmented
- class="w-110" title="">
- <div class="wrapper">
- <div class="creation-methods">
- <div v-for="(item, index) in methodsList" :key="index"
- :class="['choose-item', { active: choosedMethod == item }]" @click="choosedMethod = item">
- <span class="item-label">{{ item }}</span>
- </div>
- </div>
- <div :class="['url-source', { hidden: choosedMethod !== 'AI' }]">
- <span class="label">Source Url</span>
- <n-select class="flex-1" :options="domainList" label-field="domain" value-field="domain" v-model:value="sourceDomain"></n-select>
- </div>
- <div class="desc">
- Use AI tools to help you automatically generate email content and improve your work efficiency.
- </div>
- </div>
-
- <template #footer>
- <div class="flex justify-end">
- <n-button type="primary" @click="createTemplate" :disabled="!sourceDomain">Create</n-button>
- </div>
- </template>
- </n-modal>
+ <n-modal
+ v-model:show="show"
+ preset="card"
+ draggable
+ :close-on-esc="false"
+ :mask-closable="false"
+ segmented
+ class="w-110"
+ title="">
+ <div class="wrapper">
+ <div class="creation-methods">
+ <div
+ v-for="(item, index) in methodsList"
+ :key="index"
+ :class="['choose-item', { active: choosedMethod == item }]"
+ @click="choosedMethod = item">
+ <span class="item-label">{{ item }}</span>
+ </div>
+ </div>
+ <div :class="['url-source', { hidden: choosedMethod !== 'AI' }]">
+ <span class="label">Source Url</span>
+ <n-select
+ v-model:value="sourceDomain"
+ :options="domainList"
+ class="flex-1"
+ label-field="domain"
+ value-field="domain">
+ </n-select>
+ </div>
+ <div class="desc">
+ Use AI tools to help you automatically generate email content and improve your work
+ efficiency.
+ </div>
+ </div>
+
+ <template #footer>
+ <div class="flex justify-end">
+ <n-button type="primary" :disabled="!sourceDomain" @click="createTemplate">Create</n-button>
+ </div>
+ </template>
+ </n-modal>
</template>
<script setup lang="ts">
- import { instance } from '@/api'
- import { createAiTemplate } from '../pages/AITemplate/controller'
- import { TemplateStore } from '../pages/AITemplate/dto'
- const store = inject<TemplateStore>("modelStore")!
- const router = useRouter()
- const methodsList = ref(["Drag", "AI", "HTML"])
- const choosedMethod = ref("AI")
- const sourceDomain = ref("")
- const show = ref(false)
- const emits = defineEmits(["confirmType"])
- const domainList = ref([])
-
- /**
- * @description open modal
- */
- function open() {
- 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) {
- router.push({ name: "ai-template", params: { chatId } })
- }
- } else {
- emits("confirmType", choosedMethod.value)
- }
- }
- defineExpose({
- open,
- close
- })
-
- /**
- * @description Get domain list
- */
- async function getDomainList() {
- try {
- const res = await instance.get("/domains/list", {
- params: {
- pagge: 1,
- page_size: 100
- }
- }) as Record<string, any>
- domainList.value = res.list
- } catch (error) {
- console.warn(error)
- }
- }
- getDomainList()
+import { instance } from '@/api'
+import { createAiTemplate } from '../pages/AITemplate/controller'
+// import { TemplateStore } from '../pages/AITemplate/dto'
+
+// const store = inject<TemplateStore>('modelStore')!
+const router = useRouter()
+const methodsList = ref(['Drag', 'AI', 'HTML'])
+const choosedMethod = ref('AI')
+const sourceDomain = ref('')
+const show = ref(false)
+const emits = defineEmits(['confirmType'])
+const domainList = ref([])
+
+/**
+ * @description open modal
+ */
+function open() {
+ 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) {
+ 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
+}
+getDomainList()
</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: .1s all ease-in-out;
- box-sizing: border-box;
-
- .item-label {
- font-size: 16px;
- transition: .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);
- }
- }
- }
-
- .url-source {
- width: 90%;
- @include base.row-flex-start;
- gap: 10px;
-
- &.hidden {
- visibility: hidden;
- }
- }
-
- .desc {
- width: 90%;
- font-size: 14px;
- color: var(--color-text-3);
- }
- }
-
-</style>
\ No newline at end of file
+@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);
+ }
+ }
+ }
+
+ .url-source {
+ width: 90%;
+ @include base.row-flex-start;
+ gap: 10px;
+
+ &.hidden {
+ visibility: hidden;
+ }
+ }
+
+ .desc {
+ width: 90%;
+ font-size: 14px;
+ color: var(--color-text-3);
+ }
+}
+</style>
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 0cc253e9..5d683a3c 100644
--- a/core/frontend/src/views/template/pages/AITemplate/components/MarkdownRender.vue
+++ b/core/frontend/src/views/template/pages/AITemplate/components/MarkdownRender.vue
@@ -1,141 +1,146 @@
<template>
- <div>
- <!-- When content is code -->
- <div class="code-area" v-if="languageTit">
- <div class="code-tool">
- <span>{{ languageTit }}</span>
- <div class="tools">
- <div class="tool-item" @click="copyContent">
- <i class="i-material-symbols:chrome-restore-rounded text-5"></i>
- <span>{{ copied ? "Copied" : "Copy" }}</span>
- </div>
- <div class="tool-item" @click="viewCodeRender">
- <i class="i-mingcute:eye-2-fill text-5"></i>
- <span>View</span>
- </div>
- </div>
- </div>
- <div v-html="codeHtml"></div>
- </div>
+ <div>
+ <!-- When content is code -->
+ <div v-if="languageTit" class="code-area">
+ <div class="code-tool">
+ <span>{{ languageTit }}</span>
+ <div class="tools">
+ <div class="tool-item" @click="copyContent">
+ <i class="i-material-symbols:chrome-restore-rounded text-5"></i>
+ <span>{{ copied ? 'Copied' : 'Copy' }}</span>
+ </div>
+ <div class="tool-item" @click="viewCodeRender">
+ <i class="i-mingcute:eye-2-fill text-5"></i>
+ <span>View</span>
+ </div>
+ </div>
+ </div>
+ <div v-html="codeHtml"></div>
+ </div>
- <!-- When content is markdown -->
- <div ref="codeRef" v-html="codeHtml" v-else></div>
- </div>
+ <!-- When content is markdown -->
+ <div v-else ref="codeRef" v-html="codeHtml"></div>
+ </div>
</template>
<script setup lang="ts">
- import markdownit from "markdown-it"
- import hljs from 'highlight.js';
- import "../highlight.theme.css"
- import { removeHtmlCodeBlockMarkers } from "../controller";
- import { TemplateStore } from "../dto";
- import { useClipboard } from "@vueuse/core"
- const { copy, copied } = useClipboard()
- const store = inject<TemplateStore>("modelStore")!
- const { currentChatRecordKey, previewCode } = store
- const props = defineProps<{
- content: string,
- chatRecordKey: string
- }>()
- const emits = defineEmits(["codeRender"])
- const codeRef = ref()
- const languageTit = ref("")
- const codeHtml = ref("")
+import markdownit from 'markdown-it'
+import hljs from 'highlight.js'
+import '../highlight.theme.css'
+import { removeHtmlCodeBlockMarkers } from '../controller'
+import { TemplateStore } from '../dto'
+import { useClipboard } from '@vueuse/core'
+const { copy, copied } = useClipboard()
+const store = inject<TemplateStore>('modelStore')!
+const { currentChatRecordKey, previewCode } = store
+const props = defineProps<{
+ content: string
+ chatRecordKey: string
+}>()
+const emits = defineEmits(['codeRender'])
+const codeRef = ref()
+const languageTit = ref('')
+const codeHtml = ref('')
- const md = markdownit({
- html: true,
- linkify: true,
- typographer: true,
- langPrefix: 'language-',
- highlight: function (str, lang): any {
- languageTit.value = lang
- if (lang && hljs.getLanguage(lang)) {
- try {
- return hljs.highlight(lang, str).value;
- } catch (__) { console.warn(__) }
- }
+const md = markdownit({
+ html: true,
+ linkify: true,
+ typographer: true,
+ langPrefix: 'language-',
+ highlight: function (str, lang): any {
+ languageTit.value = lang
+ if (lang && hljs.getLanguage(lang)) {
+ try {
+ return hljs.highlight(lang, str).value
+ } catch {
+ // console.warn(__)
+ }
+ }
- return md.utils.escapeHtml(str);// 使用额外的默认转义
- }
- })
- codeHtml.value = md.render(props.content)
- watch(() => props.content, val => {
- codeHtml.value = md.render(val)
- if (languageTit.value) {
- emits("codeRender", {
- code: props.content,
- key: props.chatRecordKey
- })
- }
- })
+ return md.utils.escapeHtml(str) // 使用额外的默认转义
+ },
+})
+codeHtml.value = md.render(props.content)
+watch(
+ () => props.content,
+ val => {
+ codeHtml.value = md.render(val)
+ if (languageTit.value) {
+ emits('codeRender', {
+ code: props.content,
+ key: props.chatRecordKey,
+ })
+ }
+ }
+)
- /**
- * @description Click to view code render
- */
- function viewCodeRender() {
- currentChatRecordKey.value = props.chatRecordKey
- nextTick(() => previewCode.value = removeHtmlCodeBlockMarkers(props.content))
- }
+/**
+ * @description Click to view code render
+ */
+function viewCodeRender() {
+ currentChatRecordKey.value = props.chatRecordKey
+ nextTick(() => (previewCode.value = removeHtmlCodeBlockMarkers(props.content)))
+}
- /**
- * @description Click to copy code
- */
- function copyContent() {
- copy(props.content)
- }
+/**
+ * @description Click to copy code
+ */
+function copyContent() {
+ copy(props.content)
+}
</script>
<style scoped lang="scss">
- @use "@/styles/index" as base;
- @use "../../../mixin.scss";
+@use '@/styles/index' as base;
+@use '../../../mixin.scss';
- @mixin item-tool {
- @include base.row-flex-start;
- cursor: pointer;
- gap: 5px;
- padding: 5px 10px;
- align-items: center;
- font-size: 12px;
- border-radius: 3px;
- transition: .1s all ease-in-out;
+@mixin item-tool {
+ @include base.row-flex-start;
+ cursor: pointer;
+ gap: 5px;
+ padding: 5px 10px;
+ align-items: center;
+ font-size: 12px;
+ border-radius: 3px;
+ transition: 0.1s all ease-in-out;
- &:hover {
- background: var(--color-primary-1);
- color: #fff;
- }
+ &:hover {
+ background: var(--color-primary-1);
+ color: #fff;
+ }
- &:active {
- background: var(--color-primary-3);
- }
- }
+ &:active {
+ background: var(--color-primary-3);
+ }
+}
- .code-area {
- .code-tool {
- @include base.row-flex;
- justify-content: space-between;
- align-items: center;
- height: 34px;
- background: var(--color-card-text-1);
- color: var(--color-bg-1);
- padding: 0 0 0 10px;
+.code-area {
+ .code-tool {
+ @include base.row-flex;
+ justify-content: space-between;
+ align-items: center;
+ height: 34px;
+ background: var(--color-card-text-1);
+ color: var(--color-bg-1);
+ padding: 0 0 0 10px;
- .tools {
- @include base.row-flex-start;
- gap: 10px;
+ .tools {
+ @include base.row-flex-start;
+ gap: 10px;
- .tool-item {
- height: 34px;
- @include item-tool();
- border-radius: 0;
- }
- }
- }
+ .tool-item {
+ height: 34px;
+ @include item-tool();
+ border-radius: 0;
+ }
+ }
+ }
- :deep(pre) {
- background: var(--color-menu-1);
- margin: 0;
- padding: 10px;
- font-size: 14px;
- }
- }
-</style>
\ No newline at end of file
+ :deep(pre) {
+ background: var(--color-menu-1);
+ margin: 0;
+ padding: 10px;
+ font-size: 14px;
+ }
+}
+</style>
diff --git a/core/frontend/src/views/template/pages/AITemplate/controller/index.ts b/core/frontend/src/views/template/pages/AITemplate/controller/index.ts
index 19e806d2..cc447414 100644
--- a/core/frontend/src/views/template/pages/AITemplate/controller/index.ts
+++ b/core/frontend/src/views/template/pages/AITemplate/controller/index.ts
@@ -1,308 +1,320 @@
-import { instance } from "@/api";
-import { ChatInfo, TemplateStore } from "../dto";
-
+import { instance } from '@/api'
+import { ChatInfo, TemplateStore } from '../dto'
export const instanceOptions = {
- fetchOptions: {
- loading: 'Loading... Please wait.',
- successMessage: true,
- }
+ fetchOptions: {
+ loading: 'Loading... Please wait.',
+ successMessage: true,
+ },
}
-
-
/**
* @description Create new template
*/
export async function createNewTemplate(chatId: string, temp_name: string) {
- try {
- await instance.post("/email_template/create", {
- temp_name,
- add_type: 2,
- chat_id: chatId,
- html_content: "",
- })
- } catch (error) {
- console.warn(error)
- throw error
- }
+ try {
+ await instance.post('/email_template/create', {
+ temp_name,
+ add_type: 2,
+ chat_id: chatId,
+ html_content: '',
+ })
+ } catch (error) {
+ console.warn(error)
+ throw error
+ }
}
/**
* @description Initial template info
*/
export async function initialTemplateInfo(store: TemplateStore) {
- await getModelList(store)
- await getChatInfo(store)
+ await getModelList(store)
+ await getChatInfo(store)
}
/**
* @description Create ai template
*/
export async function createAiTemplate(sourceDomain: string) {
- try {
- const temp_name = `AI_temp_${new Date().getTime()}`
- const res = await instance.post("/askai/chat/create_chat", {
- domain: sourceDomain,
- add_type: 99,
- temp_name
- }, instanceOptions) as Record<string, any>
- await createNewTemplate(res.chatId, temp_name)
- return res.chatId
- } catch (error) {
- console.warn(error)
- return null
- }
+ try {
+ const temp_name = `AI_temp_${new Date().getTime()}`
+ const res = (await instance.post(
+ '/askai/chat/create_chat',
+ {
+ domain: sourceDomain,
+ add_type: 99,
+ temp_name,
+ },
+ instanceOptions
+ )) as Record<string, any>
+ await createNewTemplate(res.chatId, temp_name)
+ return res.chatId
+ } catch (error) {
+ console.warn(error)
+ return null
+ }
}
/**
* @description Get model list
*/
export async function getModelList(store: TemplateStore) {
- const { modelList, currentModel, currentModelTitle } = store
- try {
- modelList.value = await instance.post("/askai/supplier/models")
- if (modelList.value.length) {
- currentModel.value = modelList.value[0]
- currentModelTitle.value = modelList.value[0].title
- }
- } catch (error) {
- console.warn(error)
- }
+ const { modelList, currentModel, currentModelTitle } = store
+ try {
+ modelList.value = await instance.post('/askai/supplier/models')
+ if (modelList.value.length) {
+ currentModel.value = modelList.value[0]
+ currentModelTitle.value = modelList.value[0].title
+ }
+ } catch (error) {
+ console.warn(error)
+ }
}
/**
* @description Get chat list
*/
export async function getChatList(store: TemplateStore) {
- // const { } = store
- try {
- await instance.post("/askai/chat/get_chat_list")
- } catch (error) {
- console.warn(error)
- }
+ // const { } = store
+ try {
+ await instance.post('/askai/chat/get_chat_list')
+ } catch (error) {
+ console.warn(error)
+ }
}
/**
* @description Get chat info
*/
export async function getChatInfo(store: TemplateStore) {
- const { chatId, chatInfo, currentModel, modelList, currentModelTitle, chatRecord } = store;
- try {
- chatInfo.value = await instance.post("/askai/chat/info", { chatId: chatId.value }) as ChatInfo
- // Check chatInfo and assign currentModel and currentModelTitle
- if (chatInfo.value.modelId && modelList.value.length) {
- const findModel = modelList.value.find(item => item.modelId == chatInfo.value.modelId)
- if (findModel) {
- currentModel.value = findModel
- currentModelTitle.value = findModel.title
- }
- }
- // Init chatRecord
- for (let i = 0; i < chatInfo.value.messages.length; i++) {
- if (chatInfo.value.messages[i].role == "user") {
- chatRecord.value.set(`${chatInfo.value.messages[i].content}_+_${chatRecord.value.size}`, sliceContentToArray(chatInfo.value.messages[i + 1].content))
- }
- }
- } catch (error) {
- console.warn(error)
- }
+ const { chatId, chatInfo, currentModel, modelList, currentModelTitle, chatRecord } = store
+ try {
+ chatInfo.value = (await instance.post('/askai/chat/info', { chatId: chatId.value })) as ChatInfo
+ // Check chatInfo and assign currentModel and currentModelTitle
+ if (chatInfo.value.modelId && modelList.value.length) {
+ const findModel = modelList.value.find(item => item.modelId == chatInfo.value.modelId)
+ if (findModel) {
+ currentModel.value = findModel
+ currentModelTitle.value = findModel.title
+ }
+ }
+ // Init chatRecord
+ for (let i = 0; i < chatInfo.value.messages.length; i++) {
+ if (chatInfo.value.messages[i].role == 'user') {
+ chatRecord.value.set(
+ `${chatInfo.value.messages[i].content}_+_${chatRecord.value.size}`,
+ sliceContentToArray(chatInfo.value.messages[i + 1].content)
+ )
+ }
+ }
+ } catch (error) {
+ console.warn(error)
+ }
}
-
/**
* @description Stop chat
*/
export async function stopChat(store: TemplateStore) {
- const { chatId, isChat } = store
- try {
- await instance.post("/askai/chat/stop", { chatId: chatId.value }, instanceOptions)
- isChat.value = false
- } catch (error) {
- console.warn(error)
- }
+ const { chatId, isChat } = store
+ try {
+ await instance.post('/askai/chat/stop', { chatId: chatId.value }, instanceOptions)
+ isChat.value = false
+ } catch (error) {
+ console.warn(error)
+ }
}
-
-
/**
* Send chat and generate markdown
*/
export async function sendChat(store: TemplateStore) {
- const {
- scrollable,
- generateShow,
- chatId,
- currentModel,
- questionContent,
- chatRecord,
- currentChatRecordKey,
- scrollWrapperRef,
- chatScrollRef,
- isChat
- } = store
- const chatRecordKey = `${questionContent.value}_+_${chatRecord.value.size}`
- chatRecord.value.set(chatRecordKey, [])
- currentChatRecordKey.value = chatRecordKey
- const chatContent = questionContent.value
- questionContent.value = ""
- // Split string array
- let resultArray: string[] = [];
- // Answer text
- let answerText = '';
- // Character pointer position
- let strPos = 0
- /**
- * @description spliced content
- */
- function answerTextDeal(sseArr: Array<string>) {
- for (let index = 0; index < sseArr.length; index++) {
- if (sseArr[index]) {
- answerText += JSON.parse(sseArr[index]).content
- }
- }
- }
- try {
- scrollable.value = true
- generateShow.value = true
- isChat.value = true
- nextTick(() => chatScrollRef.value.scrollTo({ left: 0, top: scrollWrapperRef.value.offsetHeight }))
- await instance.post(
- '/askai/chat/chat', // 接口地址
- {
- chatId: chatId.value,
- supplierName: currentModel.value.supplierName,
- modelId: currentModel.value.modelId,
- content: chatContent,
- is_text: "false"
- },
- {
- fetchOptions: {
- cancelResInterceptor: true,
- },
- responseType: 'text',
- onDownloadProgress: (progressEvent) => {
- generateShow.value = false
- try {
- // Get the native XMLHttpRequest instance and extract the latest response content.
- const xhr = (progressEvent.event as ProgressEvent).target as XMLHttpRequest;
- const resText = xhr.responseText;
- // Get the incremental characters and record the latest character pointer position.
- const newContent = resText.slice(strPos)
- strPos = resText.length
- resultArray = parseSSEToObjects(newContent) as string[];
- answerTextDeal(resultArray)
- chatRecord.value.set(chatRecordKey, sliceContentToArray(answerText))
- if (scrollable.value) {
- setTimeout(() => chatScrollRef.value.scrollTo({ left: 0, top: scrollWrapperRef.value.offsetHeight }), 200)
- }
- } catch (error) {
- console.warn(error);
- }
- }
- }
- )
- scrollable.value = true
- chatScrollRef.value.scrollTo({ left: 0, top: scrollWrapperRef.value.offsetHeight })
- isChat.value = false
- } catch (error) {
- console.warn(error)
- } finally {
- generateShow.value = false
- resultArray = []
- answerText = ""
- strPos = 0
- }
+ const {
+ scrollable,
+ generateShow,
+ chatId,
+ currentModel,
+ questionContent,
+ chatRecord,
+ currentChatRecordKey,
+ scrollWrapperRef,
+ chatScrollRef,
+ isChat,
+ } = store
+ const chatRecordKey = `${questionContent.value}_+_${chatRecord.value.size}`
+ chatRecord.value.set(chatRecordKey, [])
+ currentChatRecordKey.value = chatRecordKey
+ const chatContent = questionContent.value
+ questionContent.value = ''
+ // Split string array
+ let resultArray: string[] = []
+ // Answer text
+ let answerText = ''
+ // Character pointer position
+ let strPos = 0
+ /**
+ * @description spliced content
+ */
+ function answerTextDeal(sseArr: Array<string>) {
+ for (let index = 0; index < sseArr.length; index++) {
+ if (sseArr[index]) {
+ answerText += JSON.parse(sseArr[index]).content
+ }
+ }
+ }
+ try {
+ scrollable.value = true
+ generateShow.value = true
+ isChat.value = true
+ nextTick(() =>
+ chatScrollRef.value.scrollTo({ left: 0, top: scrollWrapperRef.value.offsetHeight })
+ )
+ await instance.post(
+ '/askai/chat/chat', // 接口地址
+ {
+ chatId: chatId.value,
+ supplierName: currentModel.value.supplierName,
+ modelId: currentModel.value.modelId,
+ content: chatContent,
+ is_text: 'false',
+ },
+ {
+ fetchOptions: {
+ cancelResInterceptor: true,
+ },
+ responseType: 'text',
+ onDownloadProgress: progressEvent => {
+ generateShow.value = false
+ try {
+ // Get the native XMLHttpRequest instance and extract the latest response content.
+ const xhr = (progressEvent.event as ProgressEvent).target as XMLHttpRequest
+ const resText = xhr.responseText
+ // Get the incremental characters and record the latest character pointer position.
+ const newContent = resText.slice(strPos)
+ strPos = resText.length
+ resultArray = parseSSEToObjects(newContent) as string[]
+ answerTextDeal(resultArray)
+ chatRecord.value.set(chatRecordKey, sliceContentToArray(answerText))
+ if (scrollable.value) {
+ setTimeout(
+ () =>
+ chatScrollRef.value.scrollTo({
+ left: 0,
+ top: scrollWrapperRef.value.offsetHeight,
+ }),
+ 200
+ )
+ }
+ } catch (error) {
+ console.warn(error)
+ }
+ },
+ }
+ )
+ scrollable.value = true
+ chatScrollRef.value.scrollTo({ left: 0, top: scrollWrapperRef.value.offsetHeight })
+ isChat.value = false
+ } catch (error) {
+ console.warn(error)
+ } finally {
+ generateShow.value = false
+ resultArray = []
+ answerText = ''
+ strPos = 0
+ }
}
-
-
/**
- *
+ *
* @param sseContent @
*/
function parseSSEToObjects(sseContent: string): Array<string> {
- // 1. 按行分割
- const events = sseContent.split('\n')
- let jsonList = []
- for (const line of events) {
- // 匹配以"data:"开头的行(忽略前后空格)
- const trimmedLine = line.trim();
- if (trimmedLine.startsWith('data:')) {
- // 去除"data:"前缀,得到JSON字符串
- const jsonStr = trimmedLine.slice('data:'.length).trim();
- if (jsonStr) { // 排除空值(如最后一行的空data)
- jsonList.push(jsonStr);
- }
- }
- }
- return jsonList
+ // 1. 按行分割
+ const events = sseContent.split('\n')
+ let jsonList = []
+ for (const line of events) {
+ // 匹配以"data:"开头的行(忽略前后空格)
+ const trimmedLine = line.trim()
+ if (trimmedLine.startsWith('data:')) {
+ // 去除"data:"前缀,得到JSON字符串
+ const jsonStr = trimmedLine.slice('data:'.length).trim()
+ if (jsonStr) {
+ // 排除空值(如最后一行的空data)
+ jsonList.push(jsonStr)
+ }
+ }
+ }
+ return jsonList
}
/**
* @description 对字符内容进行分割处理
*/
function sliceContentToArray(content: string) {
- // 匹配所有代码块(闭合或未闭合)
- // 正则逻辑:```开头,匹配到内容结尾或下一个```(取较长的匹配)
- const codeBlockRegex = /```[\s\S]*?(?:```|$)/g;
- const codeBlocks = content.match(codeBlockRegex) || [];
+ // 匹配所有代码块(闭合或未闭合)
+ // 正则逻辑:```开头,匹配到内容结尾或下一个```(取较长的匹配)
+ const codeBlockRegex = /```[\s\S]*?(?:```|$)/g
+ const codeBlocks = content.match(codeBlockRegex) || []
- // 分割非代码部分
- const textParts = content.split(codeBlockRegex);
+ // 分割非代码部分
+ const textParts = content.split(codeBlockRegex)
- // 合并文本与代码块
- const result = [];
- const maxLength = Math.max(textParts.length, codeBlocks.length);
+ // 合并文本与代码块
+ const result = []
+ const maxLength = Math.max(textParts.length, codeBlocks.length)
- for (let i = 0; i < maxLength; i++) {
- if (i < textParts.length && textParts[i].trim() !== '') {
- result.push(textParts[i]);
- }
- if (i < codeBlocks.length) {
- result.push(codeBlocks[i]);
- }
- }
+ for (let i = 0; i < maxLength; i++) {
+ if (i < textParts.length && textParts[i].trim() !== '') {
+ result.push(textParts[i])
+ }
+ if (i < codeBlocks.length) {
+ result.push(codeBlocks[i])
+ }
+ }
- return result;
+ return result
}
/**
* @description Remove markdown code mark
*/
export function removeHtmlCodeBlockMarkers(content: string) {
- return content.replace(/```html/g, '').replace(/```$/gm, '');
+ return content.replace(/```html/g, '').replace(/```$/gm, '')
}
-
/**
* @description Get html template code content
*/
export async function getHtmlTemplateContent(store: TemplateStore) {
- const { chatId, previewCode } = store
- try {
- const codeContent = await instance.post("/askai/chat/get_html", { chatId: chatId.value }) as string
- previewCode.value = codeContent
- } catch (error) {
- console.warn(error)
- }
+ const { chatId, previewCode } = store
+ try {
+ const codeContent = (await instance.post('/askai/chat/get_html', {
+ chatId: chatId.value,
+ })) as string
+ previewCode.value = codeContent
+ } catch (error) {
+ console.warn(error)
+ }
}
/**
* @description Save code change
*/
export async function saveCodeChange(store: TemplateStore) {
- const { previewCode, chatId } = store
- try {
- await instance.post("/askai/chat/modify_html", { chatId: chatId.value, content: previewCode.value }, instanceOptions)
- } catch (error) {
- console.warn(error)
- }
+ const { previewCode, chatId } = store
+ try {
+ await instance.post(
+ '/askai/chat/modify_html',
+ { chatId: chatId.value, content: previewCode.value },
+ instanceOptions
+ )
+ } catch (error) {
+ console.warn(error)
+ }
}
/**
* @description Duplicate template
*/
-export async function duplicateTemplate() {
-
-}
\ No newline at end of file
+export async function duplicateTemplate() {}
diff --git a/core/frontend/src/views/template/pages/AITemplate/index.vue b/core/frontend/src/views/template/pages/AITemplate/index.vue
index c131c64c..14000221 100644
--- a/core/frontend/src/views/template/pages/AITemplate/index.vue
+++ b/core/frontend/src/views/template/pages/AITemplate/index.vue
@@ -1,334 +1,360 @@
<template>
- <div class="wrapper">
- <div class="page-tit">
- <div class="back-tool">
- <i class="i-ci:arrow-left-lg text-4"></i>
- <div class="back-btn">back</div>
- </div>
- <span class="tit-content">
- AI Template
- </span>
- </div>
-
- <div class="ai-container">
- <div class="chat-area">
- <div class="model-select">
- <n-card>
- <div class="flex justify-start items-center gap-15px">
- <!-- <span>Choose Model</span> -->
- <n-select class="flex-1" :options="modelList" label-field="title" value-field="title"
- v-model:value="currentModelTitle" @update:value="changeModel"></n-select>
- </div>
- </n-card>
- </div>
-
- <div ref="answerRef" class="answer" @wheel="handleScroll">
- <n-card class="h-100%">
- <n-scrollbar style="height: calc(100vh - 522px);" ref="chatScrollRef">
- <div ref="scrollWrapperRef">
- <template v-for="item in chatRecord" :key="item[0]">
- <div class="answer-container">
- <div class="ask-content">
- <div class="pic">
- <i
- class="i-material-symbols:account-circle text-6 text-[var(--color-primary-hover-1)]"></i>
- </div>
- <div class="text">
- {{ item[0].split("_+_")[0] }}
- </div>
- </div>
- <!-- <n-spin description="Loading please wait..." :show="generateShow"> -->
- <div class="answer-content">
- <div class="pic">
- <span
- class="text-4 text-[var(--color-primary-hover-1)]">BillionMail</span>
- </div>
- <div class="text">
- <MarkdownRender @code-render="handleCodeRender"
- v-for="(_item, _index) in item[1]" :content="_item" :key="_index"
- :chat-record-key="item[0]" class="mb-4" />
- </div>
- <div class="answer-tool" @click="handleRegenerate(item[0].toString())">
- <div class="tool-item">
- <i class="i-ri:refresh-line text-5"></i>
- <span>Regenerate</span>
- </div>
- <div class="tool-item">
- <i class="i-ri:information-2-fill text-5"></i>
- <span>Info</span>
- </div>
- </div>
- </div>
- <!-- </n-spin> -->
- </div>
- </template>
- </div>
- </n-scrollbar>
- </n-card>
- </div>
- <div class="question">
- <n-card style="height: 100%;">
- <n-input type="textarea" class="question-input" v-model:value="questionContent" @keydown.enter="sendChat(store)"></n-input>
- <div class="send-btn">
- <!-- <i
+ <div class="wrapper">
+ <div class="page-tit">
+ <div class="back-tool">
+ <i class="i-ci:arrow-left-lg text-4"></i>
+ <div class="back-btn">back</div>
+ </div>
+ <span class="tit-content"> AI Template </span>
+ </div>
+
+ <div class="ai-container">
+ <div class="chat-area">
+ <div class="model-select">
+ <n-card>
+ <div class="flex justify-start items-center gap-15px">
+ <!-- <span>Choose Model</span> -->
+ <n-select
+ v-model:value="currentModelTitle"
+ class="flex-1"
+ :options="modelList"
+ label-field="title"
+ value-field="title"
+ @update:value="changeModel">
+ </n-select>
+ </div>
+ </n-card>
+ </div>
+
+ <div ref="answerRef" class="answer" @wheel="handleScroll">
+ <n-card class="h-100%">
+ <n-scrollbar ref="chatScrollRef" style="height: calc(100vh - 522px)">
+ <div ref="scrollWrapperRef">
+ <template v-for="item in chatRecord" :key="item[0]">
+ <div class="answer-container">
+ <div class="ask-content">
+ <div class="pic">
+ <i
+ class="i-material-symbols:account-circle text-6 text-[var(--color-primary-hover-1)]"></i>
+ </div>
+ <div class="text">
+ {{ item[0].split('_+_')[0] }}
+ </div>
+ </div>
+ <!-- <n-spin description="Loading please wait..." :show="generateShow"> -->
+ <div class="answer-content">
+ <div class="pic">
+ <span class="text-4 text-[var(--color-primary-hover-1)]">BillionMail</span>
+ </div>
+ <div class="text">
+ <MarkdownRender
+ v-for="(_item, _index) in item[1]"
+ :key="_index"
+ :content="_item"
+ :chat-record-key="item[0]"
+ class="mb-4"
+ @code-render="handleCodeRender">
+ </MarkdownRender>
+ </div>
+ <div class="answer-tool" @click="handleRegenerate(item[0].toString())">
+ <div class="tool-item">
+ <i class="i-ri:refresh-line text-5"></i>
+ <span>Regenerate</span>
+ </div>
+ <div class="tool-item">
+ <i class="i-ri:information-2-fill text-5"></i>
+ <span>Info</span>
+ </div>
+ </div>
+ </div>
+ <!-- </n-spin> -->
+ </div>
+ </template>
+ </div>
+ </n-scrollbar>
+ </n-card>
+ </div>
+ <div class="question">
+ <n-card style="height: 100%">
+ <n-input
+ v-model:value="questionContent"
+ type="textarea"
+ class="question-input"
+ @keydown.enter="sendChat(store)"></n-input>
+ <div class="send-btn">
+ <!-- <i
class="i-icon-park-twotone:new-picture text-8 text-[var(--color-primary-1)] hover-text-[var(--color-primary-hover-1)]"></i> -->
- <i class="i-icon-park-twotone:arrow-circle-up text-8 text-[var(--color-primary-1)] hover-text-[var(--color-primary-hover-1)]"
- @click="sendChat(store)" v-if="!isChat"></i>
- <i class="i-svg-spinners:pulse-2 text-8 text-[var(--color-primary-1)] hover-text-[var(--color-primary-hover-1)]"
- @click="stopChat(store)" v-else></i>
- </div>
- </n-card>
- </div>
- </div>
- <div class="view-area">
- <n-card style="height: 100%;">
- <div style="height: calc(100vh - 177px)">
- <div class="h-10 flex justify-start items-center gap-2.5">
- <n-button-group size="small">
- <n-button :type="previewStatus == 'view' ? 'primary' : 'default'"
- @click="previewStatus = 'view'">
- <template #icon>
- <i class="i-mingcute:eye-2-fill text-5"></i>
- </template>
- View
- </n-button>
- <n-button :type="previewStatus == 'edit' ? 'primary' : 'default'"
- @click="previewStatus = 'edit'">
- <template #icon>
- <i class="i-tdesign:code text-5"></i>
- </template>
- Edit
- </n-button>
- </n-button-group>
- <span v-if="previewStatus == 'edit'">[Ctrl + s] to save your change</span>
- </div>
- <n-scrollbar style="height: calc(100% - 40px)">
- <div v-html="previewCode" v-if="previewStatus == 'view'"></div>
- <BtEditor :value="previewCode" style="height: calc(100vh - 217px)"
- @save="saveCodeChange(store)" v-else />
- </n-scrollbar>
- </div>
- </n-card>
- </div>
- </div>
- </div>
+ <i
+ v-if="!isChat"
+ class="i-icon-park-twotone:arrow-circle-up text-8 text-[var(--color-primary-1)] hover-text-[var(--color-primary-hover-1)]"
+ @click="sendChat(store)"></i>
+ <i
+ v-else
+ class="i-svg-spinners:pulse-2 text-8 text-[var(--color-primary-1)] hover-text-[var(--color-primary-hover-1)]"
+ @click="stopChat(store)"></i>
+ </div>
+ </n-card>
+ </div>
+ </div>
+ <div class="view-area">
+ <n-card style="height: 100%">
+ <div style="height: calc(100vh - 177px)">
+ <div class="h-10 flex justify-start items-center gap-2.5">
+ <n-button-group size="small">
+ <n-button
+ :type="previewStatus == 'view' ? 'primary' : 'default'"
+ @click="previewStatus = 'view'">
+ <template #icon>
+ <i class="i-mingcute:eye-2-fill text-5"></i>
+ </template>
+ View
+ </n-button>
+ <n-button
+ :type="previewStatus == 'edit' ? 'primary' : 'default'"
+ @click="previewStatus = 'edit'">
+ <template #icon>
+ <i class="i-tdesign:code text-5"></i>
+ </template>
+ Edit
+ </n-button>
+ </n-button-group>
+ <span v-if="previewStatus == 'edit'">[Ctrl + s] to save your change</span>
+ </div>
+ <n-scrollbar style="height: calc(100% - 40px)">
+ <div v-if="previewStatus == 'view'" v-html="previewCode"></div>
+ <BtEditor
+ v-else
+ :value="previewCode"
+ style="height: calc(100vh - 217px)"
+ @save="saveCodeChange(store)">
+ </BtEditor>
+ </n-scrollbar>
+ </div>
+ </n-card>
+ </div>
+ </div>
+ </div>
</template>
<script setup lang="ts">
- import { initialTemplateInfo, sendChat, removeHtmlCodeBlockMarkers, getHtmlTemplateContent, saveCodeChange,stopChat } from "./controller";
- import MarkdownRender from "./components/MarkdownRender.vue";
- import { useTemplateStore } from "./store";
- import { TemplateStore } from "./dto";
- import BtEditor from "@/components/base/bt-editor/index.vue"
- const store = useTemplateStore()
- provide<TemplateStore>("modelStore", store)
- const {
- chatId,
- modelList,
- currentModelTitle,
- previewCode,
- questionContent,
- chatRecord,
- currentChatRecordKey,
- currentModel,
- isChat,
- chatScrollRef,
- scrollWrapperRef,
- scrollable
- } = store
- const route = useRoute()
-
- const previewStatus = ref("view")
-
- chatId.value = route.params.chatId as string
-
- /**
- * @description Handle model select
- */
- function changeModel(_: string, options: any) {
- currentModel.value = options
- }
-
- /**
- * @description Get html template code content
- */
- getHtmlTemplateContent(store)
-
- /**
- * @description Initial chatInfo and modelList
- */
- initialTemplateInfo(store)
-
- /**
- * @description Render page code
- */
- function handleCodeRender(data: { code: string, key: string }) {
- if (data.key == currentChatRecordKey.value) {
- console.log(data.key, currentChatRecordKey.value)
- previewCode.value = removeHtmlCodeBlockMarkers(data.code)
- }
- }
-
- /**
- * @description Regenerate
- */
- function handleRegenerate(key: string) {
- questionContent.value = key.split("_+_")[0]
- sendChat(store)
- }
-
- /**
- * @description Listen scroll wrapper for height-change
- */
- function scrollwrapperHeightChange(timer?: any, index = 0) {
- let timeoutTimer = timer || null
- let startIndex = index
- if (startIndex >= 6) {
- return
- }
- if (timeoutTimer) {
- clearTimeout(timer)
- timeoutTimer = null
- }
- if (scrollWrapperRef.value.offsetHeight) {
- chatScrollRef.value.scrollTo({ left: 0, top: scrollWrapperRef.value.offsetHeight })
- startIndex++
- return
- } else {
- startIndex++
- timeoutTimer = setTimeout(() => {
- scrollwrapperHeightChange(timeoutTimer, startIndex)
- }, 100)
-
- }
- }
-
- function handleScroll(event: WheelEvent) {
- if (event.deltaY < 0) {
- scrollable.value = false
- }
- }
-
- onMounted(() => {
- scrollwrapperHeightChange()
- })
+import {
+ initialTemplateInfo,
+ sendChat,
+ removeHtmlCodeBlockMarkers,
+ getHtmlTemplateContent,
+ saveCodeChange,
+ stopChat,
+} from './controller'
+import MarkdownRender from './components/MarkdownRender.vue'
+import { useTemplateStore } from './store'
+import { TemplateStore } from './dto'
+import BtEditor from '@/components/base/bt-editor/index.vue'
+const store = useTemplateStore()
+provide<TemplateStore>('modelStore', store)
+const {
+ chatId,
+ modelList,
+ currentModelTitle,
+ previewCode,
+ questionContent,
+ chatRecord,
+ currentChatRecordKey,
+ currentModel,
+ isChat,
+ chatScrollRef,
+ scrollWrapperRef,
+ scrollable,
+} = store
+const route = useRoute()
+
+const previewStatus = ref('view')
+
+chatId.value = route.params.chatId as string
+
+/**
+ * @description Handle model select
+ */
+function changeModel(_: string, options: any) {
+ currentModel.value = options
+}
+
+/**
+ * @description Get html template code content
+ */
+getHtmlTemplateContent(store)
+
+/**
+ * @description Initial chatInfo and modelList
+ */
+initialTemplateInfo(store)
+
+/**
+ * @description Render page code
+ */
+function handleCodeRender(data: { code: string; key: string }) {
+ if (data.key == currentChatRecordKey.value) {
+ // console.log(data.key, currentChatRecordKey.value)
+ previewCode.value = removeHtmlCodeBlockMarkers(data.code)
+ }
+}
+
+/**
+ * @description Regenerate
+ */
+function handleRegenerate(key: string) {
+ questionContent.value = key.split('_+_')[0]
+ sendChat(store)
+}
+
+/**
+ * @description Listen scroll wrapper for height-change
+ */
+function scrollwrapperHeightChange(timer?: any, index = 0) {
+ let timeoutTimer = timer || null
+ let startIndex = index
+ if (startIndex >= 6) {
+ return
+ }
+ if (timeoutTimer) {
+ clearTimeout(timer)
+ timeoutTimer = null
+ }
+ if (scrollWrapperRef.value.offsetHeight) {
+ chatScrollRef.value.scrollTo({ left: 0, top: scrollWrapperRef.value.offsetHeight })
+ startIndex++
+ return
+ } else {
+ startIndex++
+ timeoutTimer = setTimeout(() => {
+ scrollwrapperHeightChange(timeoutTimer, startIndex)
+ }, 100)
+ }
+}
+
+function handleScroll(event: WheelEvent) {
+ if (event.deltaY < 0) {
+ scrollable.value = false
+ }
+}
+
+onMounted(() => {
+ scrollwrapperHeightChange()
+})
</script>
<style scoped lang="scss">
- @use "@/styles/index" as base;
- @use "../../mixin.scss";
-
- .wrapper {
- @mixin content-card {
- border-radius: 5px;
- padding: 20px;
- }
-
- @include mixin.wrapper;
-
- .page-tit {
- @include mixin.page-tit;
- }
-
- .ai-container {
- display: grid;
- grid-template-columns: 900px 1fr;
- gap: 15px;
-
- .chat-area {
- display: grid;
- grid-template-rows: 76px 1fr 230px;
- gap: 15px;
-
- .answer {
- width: 100%;
- height: calc(100vh - 472px);
-
- .answer-container {
- padding: 30px 10px;
-
- .ask-content,
- .answer-content {
- @include content-card();
- background: var(--color-bg-3);
- display: grid;
- grid-template-rows: 30px 1fr;
- gap: 10px;
- margin-bottom: 20px;
-
- .pic {
- @include base.row-flex;
- align-items: center;
- }
-
- @mixin item-tool {
- @include base.row-flex-start;
- cursor: pointer;
- gap: 5px;
- padding: 5px 10px;
- align-items: center;
- font-size: 12px;
- border-radius: 3px;
- transition: .1s all ease-in-out;
-
- &:hover {
- background: var(--color-primary-1);
- color: #fff;
- }
-
- &:active {
- background: var(--color-primary-3);
- }
- }
-
- .text {
- font-size: 14px;
-
-
- }
-
- .answer-tool {
- @include base.row-flex-end;
- border-top: 1px solid var(--color-border-1);
- height: 30px;
- padding-top: 20px;
-
- .tool-item {
- @include item-tool();
- }
- }
- }
-
- .answer-content {
- background: var(--color-bg-2);
- }
- }
- }
-
- .question {
- position: relative;
-
- .question-input {
- height: 100%;
- font-size: 14px;
- }
-
- .send-btn {
- position: absolute;
- right: 30px;
- bottom: 30px;
- @include base.row-flex-start;
- gap: 10px;
-
- i {
- cursor: pointer;
- }
- }
- }
- }
-
- .view-area {
- /* background: linear-gradient(-45deg, rgba(238, 152, 82, 0.3),rgba(35, 166, 213,.3), rgba(231, 60, 60, 0.3), rgba(35, 213, 171,.3));
+@use '@/styles/index' as base;
+@use '../../mixin.scss';
+
+.wrapper {
+ @mixin content-card {
+ border-radius: 5px;
+ padding: 20px;
+ }
+
+ @include mixin.wrapper;
+
+ .page-tit {
+ @include mixin.page-tit;
+ }
+
+ .ai-container {
+ display: grid;
+ grid-template-columns: 900px 1fr;
+ gap: 15px;
+
+ .chat-area {
+ display: grid;
+ grid-template-rows: 76px 1fr 230px;
+ gap: 15px;
+
+ .answer {
+ width: 100%;
+ height: calc(100vh - 472px);
+
+ .answer-container {
+ padding: 30px 10px;
+
+ .ask-content,
+ .answer-content {
+ @include content-card();
+ background: var(--color-bg-3);
+ display: grid;
+ grid-template-rows: 30px 1fr;
+ gap: 10px;
+ margin-bottom: 20px;
+
+ .pic {
+ @include base.row-flex;
+ align-items: center;
+ }
+
+ @mixin item-tool {
+ @include base.row-flex-start;
+ cursor: pointer;
+ gap: 5px;
+ padding: 5px 10px;
+ align-items: center;
+ font-size: 12px;
+ border-radius: 3px;
+ transition: 0.1s all ease-in-out;
+
+ &:hover {
+ background: var(--color-primary-1);
+ color: #fff;
+ }
+
+ &:active {
+ background: var(--color-primary-3);
+ }
+ }
+
+ .text {
+ font-size: 14px;
+ }
+
+ .answer-tool {
+ @include base.row-flex-end;
+ border-top: 1px solid var(--color-border-1);
+ height: 30px;
+ padding-top: 20px;
+
+ .tool-item {
+ @include item-tool();
+ }
+ }
+ }
+
+ .answer-content {
+ background: var(--color-bg-2);
+ }
+ }
+ }
+
+ .question {
+ position: relative;
+
+ .question-input {
+ height: 100%;
+ font-size: 14px;
+ }
+
+ .send-btn {
+ position: absolute;
+ right: 30px;
+ bottom: 30px;
+ @include base.row-flex-start;
+ gap: 10px;
+
+ i {
+ cursor: pointer;
+ }
+ }
+ }
+ }
+
+ /* .view-area {
+ background: linear-gradient(-45deg, rgba(238, 152, 82, 0.3),rgba(35, 166, 213,.3), rgba(231, 60, 60, 0.3), rgba(35, 213, 171,.3));
background-size: 400% 400%;
animation: gradient 15s ease infinite;
@@ -344,12 +370,8 @@
100% {
background-position: 0% 50%;
}
- } */
- }
- }
- }
-
-
-
-
-</style>
\ No newline at end of file
+ }
+ } */
+ }
+}
+</style>
diff --git a/core/frontend/types/components.d.ts b/core/frontend/types/components.d.ts
index d0a6d7b3..938cc66b 100644
--- a/core/frontend/types/components.d.ts
+++ b/core/frontend/types/components.d.ts
@@ -70,7 +70,6 @@ declare module 'vue' {
NModal: typeof import('naive-ui')['NModal']
NPagination: typeof import('naive-ui')['NPagination']
NPopover: typeof import('naive-ui')['NPopover']
- NPopver: typeof import('naive-ui')['NPopver']
NProgress: typeof import('naive-ui')['NProgress']
NRadio: typeof import('naive-ui')['NRadio']
NRadioButton: typeof import('naive-ui')['NRadioButton']