Merge branch 'main' of ssh://18.167.251.121:10002/aidlab/FiDA_Front

This commit is contained in:
2026-03-03 11:33:24 +08:00
16 changed files with 263 additions and 122 deletions

View File

@@ -55,3 +55,33 @@ export const getProjectList = (params) => {
params
})
}
/**
* 修改项目信息
* @param id 项目id
* @param data 修改项目信息参数
* @param data.name 项目名称
* @param data.type 项目类型
* @param data.region 项目区域
* @param data.style 项目风格
* @param data.temperature 项目温度
* @returns 修改项目信息
*/
export const updateProject = (id: string, data: Object) => {
return request({
url: `/api/project/${id}`,
method: 'put',
data
})
}
/**
* 删除项目
* @param id 项目id
* @returns 删除项目
*/
export const deleteProject = (id: string) => {
return request({
url: `/api/project/${id}`,
method: 'delete',
})
}

View File

@@ -26,6 +26,7 @@ export class StateManager {
}
constructor(options) {
this.vueFlow = options.vueFlow
this.zoom = ref(1)
this.nodes = ref<NodesItem[]>([]);
this.nodes_ = computed(() => {
return this.nodes.value.map((node, index) => {
@@ -61,7 +62,6 @@ export class StateManager {
return arr
})
this.zoom = ref(1)
}
/** 添加节点 */
addNode(node: NodesItem) {

View File

@@ -22,11 +22,11 @@
<p></p>
<div class="btn" @click="onSetting">
<span class="icon"><svg-icon name="setting" size="18" /></span>
<span class="label">Settings</span>
<span class="label">{{ $t('Home.setting') }}</span>
</div>
<div class="btn" @click="onLogout">
<span class="icon"><svg-icon name="logout" size="18" /></span>
<span class="label">Log out</span>
<span class="label">{{ $t('Home.logout') }}</span>
</div>
</div>
</el-popover>

View File

@@ -60,7 +60,45 @@ export default {
history: 'History',
today: 'Today',
yesterday: 'Yesterday',
earlierChat: 'Earlier Chat'
earlierChat: 'Earlier Chat',
rename: 'Rename',
delete: 'Delete',
setting: 'Setting',
logout: 'Logout',
general: 'General',
profile: 'Profile',
learnMore: 'Learn More',
userName: 'User Name',
email: 'Email',
language: 'Language',
logoutDevice: 'Log out on this device',
region: 'Region',
role: 'Role',
currentAgentProfile: 'Current Agent Profile',
currentNotificationFrequency: 'Current Notification Frequency',
timesPerHour: '{time} times per hour',
userAgreement: 'User Agreement',
privacyPolicy: 'Privacy Policy',
view: 'View',
},
Country:{
unitedStates: 'United States',
singapore: 'Singapore',
australia: 'Australia',
southKorea: 'South Korea',
china: 'China',
italy: 'Italy',
france: 'France',
japan: 'Japan',
canada: 'Canada',
germany: 'Germany',
},
Role: {
designer: 'Designer',
student: 'Student',
teacher: 'Teacher',
parent: 'Parent',
other: 'Other',
},
Input: {
placeholder: 'Please input',

View File

@@ -61,7 +61,45 @@ export default {
history: '历史记录',
today: '今天',
yesterday: '昨天',
earlierChat: '更早的'
earlierChat: '更早的',
rename: '重命名',
delete: '删除',
setting: '设置',
logout: '退出登录',
general: '通用',
profile: '个人资料',
learnMore: '了解更多',
userName: '用户名',
email: '邮箱',
language: '语言',
logoutDevice: '退出当前设备',
region: '地区',
role: '角色',
currentAgentProfile: '当前智能体个人资料',
currentNotificationFrequency: '当前通知频率',
timesPerHour: '{time} 次/小时',
userAgreement: '用户协议',
privacyPolicy: '隐私政策',
view: '查看',
},
Country: {
unitedStates: '美国',
singapore: '新加坡',
australia: '澳大利亚',
southKorea: '韩国',
china: '中国',
italy: '意大利',
france: '法国',
japan: '日本',
canada: '加拿大',
germany: '德国',
},
Role: {
designer: '设计师',
student: '学生',
teacher: '教师',
parent: '家长',
other: '其他',
},
Input: {
placeholder: '请输入',

View File

@@ -5,7 +5,7 @@
<div class="agent-title">{{ props.title }}</div>
<div class="agent-name">AI Assistant 1.0</div>
</div>
<SvgIcon name="equal" color="#0d0d0d" size="24" />
<!-- <SvgIcon name="equal" color="#0d0d0d" size="24" /> -->
</div>
<div class="agent-body flex-1 flex flex-col">
<List ref="listRef" :message-list="messageList" @regenerate="handleRegenerate" />
@@ -447,7 +447,6 @@
.agent-header {
height: 7.4rem;
border-bottom: 0.1rem solid #c9c9c9;
font-family: 'GeneralMedium';
padding: 1.4rem 3.4rem 1.4rem 3.1rem;
.agent-title {

View File

@@ -187,7 +187,6 @@
border-radius: 2rem;
background-color: #fff;
border: 0.2rem solid #e5e5e5;
font-family: 'GeneralMedium';
font-size: 1.4rem;
padding: 0 0.9rem 0 1.4rem;
cursor: pointer;

View File

@@ -109,7 +109,7 @@
padding: 1.5rem 1.45rem;
font-weight: 500;
font-size: 1.4rem;
border-radius: 2rem;
border-radius: 3rem;
position: relative;
background: white;
cursor: pointer;
@@ -122,7 +122,7 @@
rgba(233, 121, 60, 0.8) 1.61%,
rgba(255, 207, 144, 0.8) 101.01%
);
border-radius: 2.2rem;
border-radius: 2.5rem;
z-index: -1;
}
}
@@ -140,7 +140,7 @@
}
.preview-wrapper {
width: 91.2rem;
width: 56%;
}
}
</style>

View File

@@ -730,7 +730,6 @@
height: 100%;
box-shadow: none;
border: 0.1rem solid rgba(0, 0, 0, 0.1);
font-family: 'GeneralMedium';
font-weight: 500;
font-size: 1.4rem;
min-height: initial;
@@ -854,7 +853,6 @@
}
.fida-style-popover-header {
font-family: 'GeneralMedium';
font-weight: 500;
font-size: 1.6rem;
color: #000;
@@ -908,7 +906,6 @@
}
.fida-style-popover-item .fida-option-label {
font-family: 'GeneralMedium';
font-weight: 500;
font-size: 1.2rem;
color: #fff;
@@ -934,7 +931,6 @@
color: #fff;
border: none;
border-radius: 3.8rem;
font-family: 'GeneralMedium';
font-weight: 500;
font-size: 1.4rem;
cursor: pointer;
@@ -1031,7 +1027,6 @@
height: 4.4rem;
display: inline-flex;
border: 0.11rem solid #0000001a;
font-family: 'GeneralMedium';
font-weight: 500;
font-size: 1.8rem;
column-gap: 0;

View File

@@ -16,7 +16,7 @@
<span class="title" v-show="!isCollapse">{{ $t('Home.home') }}</span>
</div> -->
<div class="menu-item" @click="onTest">
<span class="title" v-show="!isCollapse">TEST</span>
<span class="title">TEST</span>
</div>
<div class="menu-item" @click="onHistory" :class="{ active: showHistory }">
<span class="icon"><svg-icon name="history" size="24" /></span>
@@ -26,7 +26,7 @@
</span>
</div>
<div class="history-list" v-show="!isCollapse && showHistory">
<div v-for="item in historyList" :key="item.name" class="history-item">
<div v-for="item in list" :key="item.name" class="history-item">
<div v-if="item.title" class="title">{{ item.name }}</div>
<div
v-else
@@ -34,18 +34,33 @@
@click="onClickHistoryItem(item)"
:class="{ active: item.id == id }"
>
<span>{{ item.name }}</span>
<input
v-show="item.edit"
type="text"
:value="item.name"
ref="inputRef"
:input-id="item.id"
@click.stop
@keyup.enter="(e) => onEnterHistoryItem(e, item)"
@blur="(e) => onBlurHistoryItem(e, item)"
/>
<span class="label" v-show="!item.edit">{{ item.name }}</span>
<el-popover
placement="right"
trigger="click"
popper-style="padding: 1rem 0.5rem;"
v-model:visible="item.visible"
>
<template #reference>
<span @click.stop class="icon"><svg-icon name="more" size="16" /></span>
</template>
<div class="history-item-menu">
<div class="rename" @click="onRenameHistoryItem(item)">Rename</div>
<div class="delete" @click="onDeleteHistoryItem(item)">Delete</div>
<div class="rename" @click="onRenameHistoryItem(item)">
{{ $t('Home.rename') }}
</div>
<div class="delete" @click="onDeleteHistoryItem(item)">
{{ $t('Home.delete') }}
</div>
</div>
</el-popover>
</div>
@@ -55,10 +70,10 @@
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import { computed, ref, nextTick } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { getProjectList } from '@/api/agent'
import { getProjectList, updateProject, deleteProject } from '@/api/agent'
import { FormatDate } from '@/utils/tools'
import MyEvent from '@/utils/myEvent'
const { t: $t } = useI18n()
@@ -72,35 +87,7 @@
globalStore.setHomeLeftNavCollapse(!isCollapse.value)
}
const showHistory = ref(true)
const todayList = ref([])
const yesterdayList = ref([])
const earlierChatList = ref([])
const historyList = computed(() => {
const list = []
if (todayList.value.length > 0) {
list.push({
title: true,
name: $t('Home.today')
})
list.push(...todayList.value)
}
if (yesterdayList.value.length > 0) {
list.push({
title: true,
name: $t('Home.yesterday')
})
list.push(...yesterdayList.value)
}
if (earlierChatList.value.length > 0) {
list.push({
title: true,
name: $t('Home.earlierChat')
})
list.push(...earlierChatList.value)
}
return list
})
const list = ref([])
const onCreateProject = () => {
router.push({ name: 'mainInput' })
@@ -120,16 +107,37 @@
const onClickHistoryItem = (item: any) => {
router.push({ name: 'agent', params: { id: item.id } })
}
const inputRef = ref(null)
const onRenameHistoryItem = (item: any) => {
// const index = historyList.value.findIndex((i: any) => i.id == item.id)
// if (index != -1) {
// }
item.visible = false
item.edit = true
nextTick(() => {
inputRef.value.forEach((v: any) => {
const id = v.getAttribute('input-id')
if (id == item.id) v.focus()
})
})
}
const onEnterHistoryItem = (e: any, item: any) => {
e.target.blur()
}
const onBlurHistoryItem = (e: any, item: any) => {
item.edit = false
const name = e.target.value
if (!name) return console.warn('未输入名称,不允许重命名')
item.name = name
updateProject(item.id, { name }).then(() => {
GetProjectList()
})
}
const onDeleteHistoryItem = (item: any) => {
// const index = historyList.value.findIndex((i: any) => i.id == item.id)
// if (index != -1) {
// historyList.value.splice(index, 1)
// }
item.visible = false
deleteProject(item.id).then(() => {
GetProjectList()
if (item.id == id.value) {
router.push({ name: 'mainInput' })
}
})
}
const GetProjectList = async () => {
@@ -137,25 +145,47 @@
page: 1,
size: 100
})
const arr = res.records || []
list.value = []
const str = 'yyyyMMdd'
const today = FormatDate(Date.now(), str)
const yesterday = FormatDate(Date.now() - 24 * 60 * 60 * 1000, str)
todayList.value = []
yesterdayList.value = []
earlierChatList.value = []
const list = res.records || []
list.forEach((item: any) => {
const obj = { ...item }
const date = FormatDate(obj.createTime * 1000, str)
const todayList = []
const yesterdayList = []
const earlierChatList = []
arr.forEach((item: any) => {
const obj = { ...item, edit: false, visible: false }
const date = FormatDate(obj.updateTime * 1000, str)
if (date == today) {
todayList.value.push(obj)
todayList.push(obj)
} else if (date == yesterday) {
yesterdayList.value.push(obj)
yesterdayList.push(obj)
} else {
earlierChatList.value.push(obj)
earlierChatList.push(obj)
}
})
}
if (todayList.length > 0) {
list.value.push({
title: true,
name: $t('Home.today')
})
list.value.push(...todayList)
}
if (yesterdayList.length > 0) {
list.value.push({
title: true,
name: $t('Home.yesterday')
})
list.value.push(...yesterdayList)
}
if (earlierChatList.length > 0) {
list.value.push({
title: true,
name: $t('Home.earlierChat')
})
list.value.push(...earlierChatList)
}
}
MyEvent.add('updateProjectList', GetProjectList)
GetProjectList()
</script>
@@ -177,6 +207,7 @@
--collapse-top-padding: 4.6rem 0 0 0;
--collapse-create-btn-width: 5.1rem;
--collapse-menu-item-width: 50%;
--collapse-menu-item-icon-margin-right: 0;
}
> .top {
display: flex;
@@ -242,6 +273,7 @@
}
> .icon {
transition: transform 0.2s ease-in-out;
margin-right: var(--collapse-menu-item-icon-margin-right, 1.6rem);
}
&.active > .jiantou {
transform: rotate(90deg);
@@ -288,6 +320,14 @@
white-space: nowrap;
overflow: hidden;
}
> input {
flex: 1;
width: 0;
height: 100%;
border: none;
outline: none;
background-color: transparent;
}
> .icon {
width: 2.5rem;
height: 2.5rem;

View File

@@ -19,12 +19,12 @@ import Input from './components/Input.vue'
.slogan{
color: #000;
font-size: 6rem;
font-family: 'GeneralMedium';
font-family: 'Medium';
font-weight: 500;
text-align: center;
margin-bottom: 5.6rem;
.fiDA{
font-family: 'GeneralBold';
font-family: 'MBold';
font-weight: 600;
}
}

View File

@@ -1,19 +1,19 @@
<template>
<div>
<div class="label">User Name</div>
<div class="label">{{ $t('Home.userName') }}</div>
<div class="value">{{ userInfo?.username || '------' }}</div>
</div>
<div>
<div class="label">Email</div>
<div class="label">{{ $t('Home.email') }}</div>
<div class="value">{{ userInfo?.email || '------' }}</div>
</div>
<div>
<div class="label">Language</div>
<div class="label">{{ $t('Home.language') }}</div>
<dropdown-menu v-model="locale" :list="langs" @change="changeLang" />
</div>
<div>
<div class="label">Log out on this device</div>
<button class="logout-btn" @click="logout">Log out</button>
<div class="label">{{ $t('Home.logoutDevice') }}</div>
<button class="logout-btn" @click="logout">{{ $t('Home.logout') }}</button>
</div>
</template>

View File

@@ -1,11 +1,11 @@
<template>
<div>
<div class="label">User Agreement</div>
<button @click="onClickUserAgreement">View</button>
<div class="label">{{ $t('Home.userAgreement') }}</div>
<button @click="onClickUserAgreement">{{ $t('Home.view') }}</button>
</div>
<div>
<div class="label">Privacy Policy</div>
<button @click="onClickPrivacy">View</button>
<div class="label">{{ $t('Home.privacyPolicy') }}</div>
<button @click="onClickPrivacy">{{ $t('Home.view') }}</button>
</div>
</template>

View File

@@ -1,22 +1,22 @@
<template>
<div>
<div class="label">Region</div>
<div class="label">{{ $t('Home.region') }}</div>
<dropdown-menu v-model="base" :list="baseList" @change="changeBase" />
</div>
<div>
<div class="label">Role</div>
<div class="label">{{ $t('Home.role') }}</div>
<dropdown-menu v-model="role" :list="roles" @change="changeRole" />
</div>
<div>
<div class="label">Current Agent Profile</div>
<div class="label">{{ $t('Home.currentAgentProfile') }}</div>
<div class="group">
<span class="icon"><svg-icon name="xiang" size="20" color="#000" /></span>
<dropdown-menu v-model="agent" :list="agents" @change="changeAgent" />
</div>
</div>
<div>
<div class="label">Current Notification Frequency</div>
<div class="value">36 times per hour</div>
<div class="label">{{ $t('Home.currentNotificationFrequency') }}</div>
<div class="value">{{ $t('Home.timesPerHour', { time: '36' }) }}</div>
</div>
</template>
@@ -27,19 +27,19 @@
import { UpdateUserProfile } from '@/api/user'
import { useI18n } from 'vue-i18n'
const userInfoStore = useUserInfoStore()
const { locale } = useI18n()
const { t } = useI18n()
const base = ref(userInfoStore.state.userInfo.base)
const baseList = ref([
{ label: 'United States', value: 'United States' },
{ label: 'Singapore', value: 'Singapore' },
{ label: 'Australia', value: 'Australia' },
{ label: 'South Korea', value: 'South Korea' },
{ label: 'China', value: 'China' },
{ label: 'Italy', value: 'Italy' },
{ label: 'France', value: 'France' },
{ label: 'Japan', value: 'Japan' },
{ label: 'Canada', value: 'Canada' },
{ label: 'Germany', value: 'Germany' }
{ label: t('Country.unitedStates'), value: 'United States' },
{ label: t('Country.singapore'), value: 'Singapore' },
{ label: t('Country.australia'), value: 'Australia' },
{ label: t('Country.southKorea'), value: 'South Korea' },
{ label: t('Country.china'), value: 'China' },
{ label: t('Country.italy'), value: 'Italy' },
{ label: t('Country.france'), value: 'France' },
{ label: t('Country.japan'), value: 'Japan' },
{ label: t('Country.canada'), value: 'Canada' },
{ label: t('Country.germany'), value: 'Germany' }
])
const changeBase = (value: string) => {
onSubmit({ base: value })
@@ -47,17 +47,17 @@
const role = ref(userInfoStore.state.userInfo.role)
const roles = ref([
{ label: 'Designer', value: 'Designer' },
{ label: 'Student', value: 'Student' },
{ label: 'Teacher', value: 'Teacher' },
{ label: 'Parent', value: 'Parent' },
{ value: 'Other', label: 'Other' }
{ label: t('Role.designer'), value: 'Designer' },
{ label: t('Role.student'), value: 'Student' },
{ label: t('Role.teacher'), value: 'Teacher' },
{ label: t('Role.parent'), value: 'Parent' },
{ label: t('Role.other'), value: 'Other' }
])
const changeRole = (value: string) => {
onSubmit({ role: value })
}
const agent = ref("Partner")
const agent = ref('Partner')
const agents = ref([
{ label: 'Partner', value: 'Partner' },
{ label: 'Observer', value: 'Observer' },

View File

@@ -9,7 +9,7 @@
>
<template #header="{ close }">
<div class="setting-header">
<div class="title">Setting</div>
<div class="title">{{ $t('Home.setting') }}</div>
<span class="close" @click="close">
<svg-icon name="close" size="10" color="#000" />
</span>
@@ -56,9 +56,9 @@
const nav = ref('setting')
const navs = shallowRef([
{ icon: 'setting', label: 'General', component: General },
{ icon: 'profile', label: 'Profile', component: Profile },
{ icon: 'learn-more', label: 'Learn more', component: LearnMore }
{ icon: 'setting', label: $t('Home.general'), component: General },
{ icon: 'profile', label: $t('Home.profile'), component: Profile },
{ icon: 'learn-more', label: $t('Home.learnMore'), component: LearnMore }
])
</script>

View File

@@ -35,27 +35,29 @@
<script setup lang="ts">
import { computed, ref, reactive } from 'vue'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const router = useRouter()
const emit = defineEmits(['next'])
const data = reactive({
baseList: [
{ label: 'United States', value: 'United States' },
{ label: 'Singapore', value: 'Singapore' },
{ label: 'Australia', value: 'Australia' },
{ label: 'South Korea', value: 'South Korea' },
{ label: 'China', value: 'China' },
{ label: 'Italy', value: 'Italy' },
{ label: 'France', value: 'France' },
{ label: 'Japan', value: 'Japan' },
{ label: 'Canada', value: 'Canada' },
{ label: 'Germany', value: 'Germany' }
{ label: t('Country.unitedStates'), value: 'United States' },
{ label: t('Country.singapore'), value: 'Singapore' },
{ label: t('Country.australia'), value: 'Australia' },
{ label: t('Country.southKorea'), value: 'South Korea' },
{ label: t('Country.china'), value: 'China' },
{ label: t('Country.italy'), value: 'Italy' },
{ label: t('Country.france'), value: 'France' },
{ label: t('Country.japan'), value: 'Japan' },
{ label: t('Country.canada'), value: 'Canada' },
{ label: t('Country.germany'), value: 'Germany' }
],
roleList: [
{ label: 'Designer', value: 'Designer' },
{ value: 'Student', label: 'Student' },
{ value: 'Teacher', label: 'Teacher' },
{ value: 'Parent', label: 'Parent' },
{ value: 'Other', label: 'Other' }
{ label: t('Role.designer'), value: 'Designer' },
{ label: t('Role.student'), value: 'Student' },
{ label: t('Role.teacher'), value: 'Teacher' },
{ label: t('Role.parent'), value: 'Parent' },
{ label: t('Role.other'), value: 'Other' }
],
base: 'China',
role: 'Student'