Commit 7e941450 authored by nick zheng's avatar nick zheng

Merge branch 'beta' into 'master'

Beta

See merge request !115
parents 561a4e8b 6f07ed6f
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="mobile-web-app-capable" content="yes" />
<meta <meta
name="viewport" name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
......
...@@ -12,6 +12,8 @@ const isShowModal = ref(false) ...@@ -12,6 +12,8 @@ const isShowModal = ref(false)
const modalOptions = reactive({ const modalOptions = reactive({
title: t('common_module.tip'), title: t('common_module.tip'),
content: '', content: '',
cancelText: t('common_module.cancel_btn_text'),
confirmText: t('common_module.confirm_btn_text'),
}) })
let _modalStatusResolve = (_value?: any) => {} let _modalStatusResolve = (_value?: any) => {}
...@@ -33,9 +35,11 @@ function handleConfirm() { ...@@ -33,9 +35,11 @@ function handleConfirm() {
_modalStatusResolve(true) _modalStatusResolve(true)
} }
function handleShowModal(content: string, title?: string) { function handleShowModal(content: string, title?: string, cancelText?: string, confirmText?: string) {
modalOptions.content = content modalOptions.content = content
title && (modalOptions.title = title) title && (modalOptions.title = title)
cancelText && (modalOptions.cancelText = cancelText)
confirmText && (modalOptions.confirmText = confirmText)
isShowModal.value = true isShowModal.value = true
...@@ -63,11 +67,11 @@ function handleShowModal(content: string, title?: string) { ...@@ -63,11 +67,11 @@ function handleShowModal(content: string, title?: string) {
<div class="mt-[50px] text-end"> <div class="mt-[50px] text-end">
<n-button color="#F5F5F5" round class="!px-[34px] !py-[10px] !text-[14px] !text-[#333]" @click="handleCancel"> <n-button color="#F5F5F5" round class="!px-[34px] !py-[10px] !text-[14px] !text-[#333]" @click="handleCancel">
{{ t('common_module.cancel_btn_text') }} {{ modalOptions.cancelText || t('common_module.cancel_btn_text') }}
</n-button> </n-button>
<n-button color="#6F77FF" round class="!ml-[12px] !px-[34px] !py-[10px] !text-[14px]" @click="handleConfirm"> <n-button color="#6F77FF" round class="!ml-[12px] !px-[34px] !py-[10px] !text-[14px]" @click="handleConfirm">
{{ t('common_module.confirm_btn_text') }} {{ modalOptions.confirmText || t('common_module.confirm_btn_text') }}
</n-button> </n-button>
</div> </div>
</div> </div>
......
...@@ -126,6 +126,7 @@ common_module: ...@@ -126,6 +126,7 @@ common_module:
unlimited_duration: 'Unlimited duration' unlimited_duration: 'Unlimited duration'
buy_now: 'Buy now' buy_now: 'Buy now'
payment_success: 'Payment success' payment_success: 'Payment success'
back: 'Back'
dialogue_module: dialogue_module:
continue_question_message: 'You can keep asking questions' continue_question_message: 'You can keep asking questions'
...@@ -557,6 +558,7 @@ equity_module: ...@@ -557,6 +558,7 @@ equity_module:
point_recharge: 'Point recharge' point_recharge: 'Point recharge'
get_points_for_interacting_with_the_ai: 'Get {points} points for interacting with the AI' get_points_for_interacting_with_the_ai: 'Get {points} points for interacting with the AI'
no_time_limit_when_used_up: 'No time limit, when used up' no_time_limit_when_used_up: 'No time limit, when used up'
agents_created_exceeds_tip: 'The number of agents created exceeds the current package benefits, please upgrade the package'
order_manage_module: order_manage_module:
package_name: 'PackageName' package_name: 'PackageName'
......
...@@ -125,6 +125,7 @@ common_module: ...@@ -125,6 +125,7 @@ common_module:
unlimited_duration: '无期限' unlimited_duration: '无期限'
buy_now: '立即购买' buy_now: '立即购买'
payment_success: '支付成功' payment_success: '支付成功'
back: '返回'
dialogue_module: dialogue_module:
continue_question_message: '你可以继续提问' continue_question_message: '你可以继续提问'
...@@ -555,6 +556,7 @@ equity_module: ...@@ -555,6 +556,7 @@ equity_module:
point_recharge: '积分充值' point_recharge: '积分充值'
get_points_for_interacting_with_the_ai: '获得{points}积分,用于和AI互动行动' get_points_for_interacting_with_the_ai: '获得{points}积分,用于和AI互动行动'
no_time_limit_when_used_up: '无期限,用完即止' no_time_limit_when_used_up: '无期限,用完即止'
agents_created_exceeds_tip: '创建应用数量超出当前套餐权益,请升级套餐'
order_manage_module: order_manage_module:
package_name: '套餐名称' package_name: '套餐名称'
......
...@@ -125,6 +125,7 @@ common_module: ...@@ -125,6 +125,7 @@ common_module:
unlimited_duration: '無期限' unlimited_duration: '無期限'
buy_now: '立即購買' buy_now: '立即購買'
payment_success: '支付成功' payment_success: '支付成功'
back: '返回'
dialogue_module: dialogue_module:
continue_question_message: '你可以繼續提問' continue_question_message: '你可以繼續提問'
...@@ -555,6 +556,7 @@ equity_module: ...@@ -555,6 +556,7 @@ equity_module:
point_recharge: '积分充值' point_recharge: '积分充值'
get_points_for_interacting_with_the_ai: '獲得{points}積分,用於和AI互動行動' get_points_for_interacting_with_the_ai: '獲得{points}積分,用於和AI互動行動'
no_time_limit_when_used_up: '無期限,用完即止' no_time_limit_when_used_up: '無期限,用完即止'
agents_created_exceeds_tip: '創建應用數量超出當前套餐權益,請升級套餐'
order_manage_module: order_manage_module:
package_name: '套餐名稱' package_name: '套餐名稱'
......
...@@ -4,6 +4,7 @@ import { FormInst, InputInst } from 'naive-ui' ...@@ -4,6 +4,7 @@ import { FormInst, InputInst } from 'naive-ui'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { Emitter } from 'mitt' import { Emitter } from 'mitt'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { useRouter } from 'vue-router'
import { useThrottleFn } from '@vueuse/core' import { useThrottleFn } from '@vueuse/core'
import CustomIcon from '@/components/custom-icon/custom-icon.vue' import CustomIcon from '@/components/custom-icon/custom-icon.vue'
import { Help, People, RightOne } from '@icon-park/vue-next' import { Help, People, RightOne } from '@icon-park/vue-next'
...@@ -11,6 +12,7 @@ import UploadImage from '@/components/upload-image/upload-image.vue' ...@@ -11,6 +12,7 @@ import UploadImage from '@/components/upload-image/upload-image.vue'
import AutoConfigModal from './components/auto-config-modal.vue' import AutoConfigModal from './components/auto-config-modal.vue'
import OptimizeSystemModal from './components/optimize-system-modal.vue' import OptimizeSystemModal from './components/optimize-system-modal.vue'
import { usePersonalAppConfigStore } from '@/store/modules/personal-app-config' import { usePersonalAppConfigStore } from '@/store/modules/personal-app-config'
import { useUserStore } from '@/store/modules/user'
import { PersonalAppConfigState } from '@/store/types/personal-app-config' import { PersonalAppConfigState } from '@/store/types/personal-app-config'
import { import {
fetchCreateAgentAvatar, fetchCreateAgentAvatar,
...@@ -28,7 +30,10 @@ import AgentRoleSetting from './components/agent-role-setting.vue' ...@@ -28,7 +30,10 @@ import AgentRoleSetting from './components/agent-role-setting.vue'
const { t } = useI18n() const { t } = useI18n()
const router = useRouter()
const personalAppConfigStore = usePersonalAppConfigStore() const personalAppConfigStore = usePersonalAppConfigStore()
const userStore = useUserStore()
const { baseInfo, commConfig, commModelConfig, knowledgeConfig } = storeToRefs(personalAppConfigStore) const { baseInfo, commConfig, commModelConfig, knowledgeConfig } = storeToRefs(personalAppConfigStore)
...@@ -130,6 +135,21 @@ async function handleCreatePersonalAgent() { ...@@ -130,6 +135,21 @@ async function handleCreatePersonalAgent() {
return return
} }
await handleGetEquityInfo()
if (userStore.equityInfo.usedAgentCount >= userStore.equityInfo.maxAgentCount) {
window.$message
.ctWarning(t('equity_module.agents_created_exceeds_tip'), '', t('common_module.back'))
.then(() => {
router.replace({ name: 'Equity' })
})
.catch(() => {
router.back()
})
handleStopGenerate()
return
}
const res = await fetchSaveAgentApplication<PersonalAppConfigState>(personalAppConfigStore.$state) const res = await fetchSaveAgentApplication<PersonalAppConfigState>(personalAppConfigStore.$state)
if (res.code === 0) { if (res.code === 0) {
...@@ -342,6 +362,17 @@ function handleStopGenerate() { ...@@ -342,6 +362,17 @@ function handleStopGenerate() {
generateAgentSystemController?.abort() generateAgentSystemController?.abort()
isFullScreenLoading.value = false isFullScreenLoading.value = false
} }
async function handleGetEquityInfo() {
if (!userStore.isLogin) {
router.push({
name: 'Login',
query: { redirect: encodeURIComponent(router.currentRoute.value.fullPath) },
})
}
await userStore.fetchUpdateEquityInfo()
}
</script> </script>
<template> <template>
......
...@@ -3,7 +3,7 @@ declare interface Window { ...@@ -3,7 +3,7 @@ declare interface Window {
$loadingBar: import('naive-ui').LoadingBarProviderInst $loadingBar: import('naive-ui').LoadingBarProviderInst
$dialog: import('naive-ui').DialogProviderInst $dialog: import('naive-ui').DialogProviderInst
$message: import('naive-ui').MessageProviderInst & { $message: import('naive-ui').MessageProviderInst & {
ctWarning: (message: string, title?: string) => Promise<boolean | Error> ctWarning: (message: string, title?: string, cancelText?: string, confirmText?: string) => Promise<boolean | Error>
} }
$notification: import('naive-ui').NotificationProviderInst $notification: import('naive-ui').NotificationProviderInst
} }
......
...@@ -125,6 +125,7 @@ declare namespace I18n { ...@@ -125,6 +125,7 @@ declare namespace I18n {
support: string support: string
buy_now: string buy_now: string
payment_success: string payment_success: string
back: string
dialogue_module: { dialogue_module: {
continue_question_message: string continue_question_message: string
...@@ -571,6 +572,7 @@ declare namespace I18n { ...@@ -571,6 +572,7 @@ declare namespace I18n {
point_recharge: string point_recharge: string
get_points_for_interacting_with_the_ai: string get_points_for_interacting_with_the_ai: string
no_time_limit_when_used_up: string no_time_limit_when_used_up: string
agents_created_exceeds_tip: string
} }
order_manage_module: { order_manage_module: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment