feat: 应用对话显示应用图标

feat: 应用对话显示应用图标
This commit is contained in:
wangdan-fit2cloud 2024-07-23 22:57:48 -07:00 committed by GitHub
commit 4e08fae133
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 115 additions and 15 deletions

View File

@ -58,9 +58,29 @@
> >
<div class="workflow-debug-header" :class="!isDefaultTheme ? 'custom-header' : ''"> <div class="workflow-debug-header" :class="!isDefaultTheme ? 'custom-header' : ''">
<div class="flex-between"> <div class="flex-between">
<h4 class="ml-24"> <div class="flex align-center">
<div class="mr-12 ml-24">
<AppAvatar
v-if="isAppIcon(detail?.icon)"
shape="square"
:size="32"
style="background: none"
>
<img :src="detail?.icon" alt="" />
</AppAvatar>
<AppAvatar
v-else-if="detail?.name"
:name="detail?.name"
pinyinColor
shape="square"
:size="32"
/>
</div>
<h4>
{{ detail?.name || $t('views.application.applicationForm.form.appName.label') }} {{ detail?.name || $t('views.application.applicationForm.form.appName.label') }}
</h4> </h4>
</div>
<div class="mr-16"> <div class="mr-16">
<el-button link @click="enlarge = !enlarge"> <el-button link @click="enlarge = !enlarge">
<AppIcon <AppIcon
@ -89,6 +109,7 @@ import Workflow from '@/workflow/index.vue'
import { menuNodes } from '@/workflow/common/data' import { menuNodes } from '@/workflow/common/data'
import { iconComponent } from '@/workflow/icons/utils' import { iconComponent } from '@/workflow/icons/utils'
import applicationApi from '@/api/application' import applicationApi from '@/api/application'
import { isAppIcon } from '@/utils/application'
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message' import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
import { datetimeFormat } from '@/utils/time' import { datetimeFormat } from '@/utils/time'
import useStore from '@/stores' import useStore from '@/stores'

View File

@ -273,11 +273,31 @@
{{ $t('views.application.applicationForm.form.apptest') }} {{ $t('views.application.applicationForm.form.apptest') }}
</h4> </h4>
<div class="dialog-bg"> <div class="dialog-bg">
<h4 class="p-24"> <div class="flex align-center p-24">
<div class="mr-12">
<AppAvatar
v-if="isAppIcon(applicationForm?.icon)"
shape="square"
:size="32"
style="background: none"
>
<img :src="applicationForm?.icon" alt="" />
</AppAvatar>
<AppAvatar
v-else-if="applicationForm?.name"
:name="applicationForm?.name"
pinyinColor
shape="square"
:size="32"
/>
</div>
<h4>
{{ {{
applicationForm?.name || $t('views.application.applicationForm.form.appName.label') applicationForm?.name || $t('views.application.applicationForm.form.appName.label')
}} }}
</h4> </h4>
</div>
<div class="scrollbar-height"> <div class="scrollbar-height">
<AiChat :data="applicationForm"></AiChat> <AiChat :data="applicationForm"></AiChat>
</div> </div>
@ -312,6 +332,7 @@ import AddDatasetDialog from './component/AddDatasetDialog.vue'
import CreateModelDialog from '@/views/template/component/CreateModelDialog.vue' import CreateModelDialog from '@/views/template/component/CreateModelDialog.vue'
import SelectProviderDialog from '@/views/template/component/SelectProviderDialog.vue' import SelectProviderDialog from '@/views/template/component/SelectProviderDialog.vue'
import applicationApi from '@/api/application' import applicationApi from '@/api/application'
import { isAppIcon } from '@/utils/application'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import type { ApplicationFormType } from '@/api/type/application' import type { ApplicationFormType } from '@/api/type/application'
import type { Provider } from '@/api/type/model' import type { Provider } from '@/api/type/model'

View File

@ -1,8 +1,26 @@
<template> <template>
<div class="chat layout-bg" v-loading="loading"> <div class="chat layout-bg" v-loading="loading">
<div class="chat__header" :class="!isDefaultTheme ? 'custom-header' : ''"> <div class="chat__header" :class="!isDefaultTheme ? 'custom-header' : ''">
<div class="chat-width"> <div class="chat-width flex align-center">
<h2 class="ml-24">{{ applicationDetail?.name }}</h2> <div class="mr-12 ml-24">
<AppAvatar
v-if="isAppIcon(applicationDetail?.icon)"
shape="square"
:size="32"
style="background: none"
>
<img :src="applicationDetail?.icon" alt="" />
</AppAvatar>
<AppAvatar
v-else-if="applicationDetail?.name"
:name="applicationDetail?.name"
pinyinColor
shape="square"
:size="32"
/>
</div>
<h2>{{ applicationDetail?.name }}</h2>
</div> </div>
</div> </div>
<div class="chat__main chat-width"> <div class="chat__main chat-width">
@ -18,6 +36,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, computed } from 'vue' import { ref, onMounted, computed } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { isAppIcon } from '@/utils/application'
import useStore from '@/stores' import useStore from '@/stores'
const route = useRoute() const route = useRoute()
const { const {

View File

@ -1,8 +1,26 @@
<template> <template>
<div class="chat-embed layout-bg" v-loading="loading"> <div class="chat-embed layout-bg" v-loading="loading">
<div class="chat-embed__header" :class="!isDefaultTheme ? 'custom-header' : ''"> <div class="chat-embed__header" :class="!isDefaultTheme ? 'custom-header' : ''">
<div class="chat-width"> <div class="chat-width flex align-center">
<h4 class="ml-24">{{ applicationDetail?.name }}</h4> <div class="mr-12 ml-24">
<AppAvatar
v-if="isAppIcon(applicationDetail?.icon)"
shape="square"
:size="32"
style="background: none"
>
<img :src="applicationDetail?.icon" alt="" />
</AppAvatar>
<AppAvatar
v-else-if="applicationDetail?.name"
:name="applicationDetail?.name"
pinyinColor
shape="square"
:size="32"
/>
</div>
<h4>{{ applicationDetail?.name }}</h4>
</div> </div>
</div> </div>
<div class="chat-embed__main"> <div class="chat-embed__main">
@ -81,6 +99,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, reactive, nextTick, computed } from 'vue' import { ref, onMounted, reactive, nextTick, computed } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { isAppIcon } from '@/utils/application'
import useStore from '@/stores' import useStore from '@/stores'
const route = useRoute() const route = useRoute()
const { const {

View File

@ -1,7 +1,27 @@
<template> <template>
<div class="chat-pc layout-bg" :class="classObj" v-loading="loading"> <div class="chat-pc layout-bg" :class="classObj" v-loading="loading">
<div class="chat-pc__header" :class="!isDefaultTheme ? 'custom-header' : ''"> <div class="chat-pc__header" :class="!isDefaultTheme ? 'custom-header' : ''">
<h4 class="ml-24">{{ applicationDetail?.name }}</h4> <div class="flex align-center">
<div class="mr-12 ml-24">
<AppAvatar
v-if="isAppIcon(applicationDetail?.icon)"
shape="square"
:size="32"
style="background: none"
>
<img :src="applicationDetail?.icon" alt="" />
</AppAvatar>
<AppAvatar
v-else-if="applicationDetail?.name"
:name="applicationDetail?.name"
pinyinColor
shape="square"
:size="32"
/>
</div>
<h4>{{ applicationDetail?.name }}</h4>
</div>
</div> </div>
<div class="flex"> <div class="flex">
<div class="chat-pc__left border-r"> <div class="chat-pc__left border-r">
@ -108,6 +128,7 @@ import { reactive, ref, onMounted, nextTick, computed } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { marked } from 'marked' import { marked } from 'marked'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
import { isAppIcon } from '@/utils/application'
import useStore from '@/stores' import useStore from '@/stores'
import useResize from '@/layout/hooks/useResize' import useResize from '@/layout/hooks/useResize'
@ -207,7 +228,6 @@ function getAppProfile() {
if (res.data?.show_history) { if (res.data?.show_history) {
getChatLog(applicationDetail.value.id) getChatLog(applicationDetail.value.id)
} }
}) })
.catch(() => { .catch(() => {
applicationAvailable.value = false applicationAvailable.value = false