feat: 优化团队管理
This commit is contained in:
parent
71606fde71
commit
2cdc72935e
51
ui/src/components/ai-dialog/OperationButton.vue
Normal file
51
ui/src/components/ai-dialog/OperationButton.vue
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-tooltip effect="dark" content="重新生成" placement="top">
|
||||||
|
<el-button text @click.stop @click="getAccessToken(item.id)">
|
||||||
|
<AppIcon iconName="VideoPlay"></AppIcon>
|
||||||
|
</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-divider direction="vertical" />
|
||||||
|
<el-tooltip effect="dark" content="复制" placement="top">
|
||||||
|
<el-button text @click="copyClick(item.answer_text)">
|
||||||
|
<AppIcon iconName="app-copy"></AppIcon>
|
||||||
|
</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-divider direction="vertical" />
|
||||||
|
<el-tooltip effect="dark" content="赞同" placement="top">
|
||||||
|
<el-button text>
|
||||||
|
<AppIcon iconName="app-like"></AppIcon>
|
||||||
|
</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip effect="dark" content="取消赞同" placement="top">
|
||||||
|
<el-button text>
|
||||||
|
<AppIcon iconName="app-like-color"></AppIcon>
|
||||||
|
</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-divider direction="vertical" />
|
||||||
|
<el-tooltip effect="dark" content="反对" placement="top">
|
||||||
|
<el-button text>
|
||||||
|
<AppIcon iconName="app-oppose"></AppIcon>
|
||||||
|
</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip effect="dark" content="取消反对" placement="top">
|
||||||
|
<el-button text>
|
||||||
|
<AppIcon iconName="app-oppose-color"></AppIcon>
|
||||||
|
</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { copyClick } from '@/utils/clipboard'
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:data'])
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
@ -79,51 +79,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div v-if="item.write_ed && props.appId">
|
<!-- <div v-if="item.write_ed && props.appId">
|
||||||
<el-tooltip effect="dark" content="重新生成" placement="top">
|
<OperationButton :data="item" />
|
||||||
<el-button text @click.stop @click="getAccessToken(item.id)">
|
|
||||||
<AppIcon iconName="VideoPlay"></AppIcon>
|
|
||||||
</el-button>
|
|
||||||
</el-tooltip>
|
|
||||||
<el-divider direction="vertical" />
|
|
||||||
<el-tooltip effect="dark" content="复制" placement="top">
|
|
||||||
<el-button text @click="copyClick(item.answer_text)">
|
|
||||||
<AppIcon iconName="app-copy"></AppIcon>
|
|
||||||
</el-button>
|
|
||||||
</el-tooltip>
|
|
||||||
<el-divider direction="vertical" />
|
|
||||||
<el-tooltip effect="dark" content="赞同" placement="top">
|
|
||||||
<el-button
|
|
||||||
text
|
|
||||||
@click.stop="router.push({ path: `/application/${item.id}/setting` })"
|
|
||||||
>
|
|
||||||
<AppIcon iconName="app-like"></AppIcon>
|
|
||||||
</el-button>
|
|
||||||
</el-tooltip>
|
|
||||||
<el-tooltip effect="dark" content="取消赞同" placement="top">
|
|
||||||
<el-button
|
|
||||||
text
|
|
||||||
@click.stop="router.push({ path: `/application/${item.id}/setting` })"
|
|
||||||
>
|
|
||||||
<AppIcon iconName="app-like-color"></AppIcon>
|
|
||||||
</el-button>
|
|
||||||
</el-tooltip>
|
|
||||||
<el-divider direction="vertical" />
|
|
||||||
<el-tooltip effect="dark" content="反对" placement="top">
|
|
||||||
<el-button
|
|
||||||
text
|
|
||||||
@click.stop="router.push({ path: `/application/${item.id}/setting` })"
|
|
||||||
>
|
|
||||||
<AppIcon iconName="app-oppose"></AppIcon>
|
|
||||||
</el-button>
|
|
||||||
</el-tooltip>
|
|
||||||
<el-tooltip effect="dark" content="取消反对" placement="top">
|
|
||||||
<el-button
|
|
||||||
text
|
|
||||||
@click.stop="router.push({ path: `/application/${item.id}/setting` })"
|
|
||||||
>
|
|
||||||
<AppIcon iconName="app-oppose-color"></AppIcon>
|
|
||||||
</el-button>
|
|
||||||
</el-tooltip>
|
|
||||||
</div> -->
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -154,10 +110,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, nextTick, onUpdated, computed } from 'vue'
|
import { ref, nextTick, onUpdated, computed } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
import OperationButton from './OperationButton.vue'
|
||||||
import applicationApi from '@/api/application'
|
import applicationApi from '@/api/application'
|
||||||
import { ChatManagement, type chatType } from '@/api/type/application'
|
import { ChatManagement, type chatType } from '@/api/type/application'
|
||||||
import { randomId } from '@/utils/utils'
|
import { randomId } from '@/utils/utils'
|
||||||
import { copyClick } from '@/utils/clipboard'
|
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
@ -258,6 +214,7 @@ function chatMessage() {
|
|||||||
ChatManagement.addChatRecord(row, 50, loading)
|
ChatManagement.addChatRecord(row, 50, loading)
|
||||||
ChatManagement.write(id)
|
ChatManagement.write(id)
|
||||||
const reader = response.body.getReader()
|
const reader = response.body.getReader()
|
||||||
|
/*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
|
||||||
while (true) {
|
while (true) {
|
||||||
const { done, value } = await reader.read()
|
const { done, value } = await reader.read()
|
||||||
if (done) {
|
if (done) {
|
||||||
@ -273,7 +230,9 @@ function chatMessage() {
|
|||||||
ChatManagement.append(id, content)
|
ChatManagement.append(id, content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {
|
||||||
|
// console
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -2,18 +2,10 @@
|
|||||||
<div class="common-list">
|
<div class="common-list">
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<ul v-if="data.length > 0">
|
<ul v-if="data.length > 0">
|
||||||
<li
|
|
||||||
v-if="slots.prefix"
|
|
||||||
@click="clickHandle()"
|
|
||||||
:class="modelValue === undefined || modelValue === null ? 'active' : ''"
|
|
||||||
class="cursor"
|
|
||||||
>
|
|
||||||
<slot name="prefix"> </slot>
|
|
||||||
</li>
|
|
||||||
<template v-for="(item, index) in data" :key="index">
|
<template v-for="(item, index) in data" :key="index">
|
||||||
<li
|
<li
|
||||||
@click.prevent="clickHandle(item)"
|
@click.prevent="clickHandle(item, index)"
|
||||||
:class="modelValue === item ? 'active' : ''"
|
:class="current === index ? 'active' : ''"
|
||||||
class="cursor"
|
class="cursor"
|
||||||
>
|
>
|
||||||
<slot :row="item" :index="index"> </slot>
|
<slot :row="item" :index="index"> </slot>
|
||||||
@ -32,8 +24,6 @@ defineOptions({ name: 'CommonList' })
|
|||||||
|
|
||||||
withDefaults(
|
withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
modelValue?: any
|
|
||||||
|
|
||||||
data: Array<any>
|
data: Array<any>
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
@ -41,11 +31,13 @@ withDefaults(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const emit = defineEmits(['click', 'update:modelValue'])
|
const emit = defineEmits(['click'])
|
||||||
|
|
||||||
function clickHandle(row?: any) {
|
const current = ref(0)
|
||||||
|
|
||||||
|
function clickHandle(row: any, index: number) {
|
||||||
|
current.value = index
|
||||||
emit('click', row)
|
emit('click', row)
|
||||||
emit('update:modelValue', row)
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@ -2,11 +2,7 @@
|
|||||||
<div v-if="!menu.meta || !menu.meta.hidden" class="sidebar-item">
|
<div v-if="!menu.meta || !menu.meta.hidden" class="sidebar-item">
|
||||||
<el-menu-item ref="subMenu" :index="menu.path" popper-class="sidebar-popper">
|
<el-menu-item ref="subMenu" :index="menu.path" popper-class="sidebar-popper">
|
||||||
<template #title>
|
<template #title>
|
||||||
<AppIcon
|
<AppIcon v-if="menu.meta && menu.meta.icon" :iconName="menuIcon" class="sidebar-icon" />
|
||||||
v-if="menu.meta && menu.meta.icon"
|
|
||||||
:iconName="menu.meta.icon"
|
|
||||||
class="sidebar-icon"
|
|
||||||
/>
|
|
||||||
<span v-if="menu.meta && menu.meta.title">{{ menu.meta.title }}</span>
|
<span v-if="menu.meta && menu.meta.title">{{ menu.meta.title }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
@ -14,11 +10,20 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue'
|
||||||
import { type RouteRecordRaw } from 'vue-router'
|
import { type RouteRecordRaw } from 'vue-router'
|
||||||
|
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
menu: RouteRecordRaw
|
menu: RouteRecordRaw
|
||||||
|
activeMenu: any
|
||||||
}>()
|
}>()
|
||||||
|
const menuIcon = computed(() => {
|
||||||
|
if (props.activeMenu === props.menu.path) {
|
||||||
|
return props.menu.meta?.iconActive || props.menu?.meta?.icon
|
||||||
|
} else {
|
||||||
|
return props.menu?.meta?.icon
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
v-for="(menu, index) in subMenuList"
|
v-for="(menu, index) in subMenuList"
|
||||||
:key="index"
|
:key="index"
|
||||||
:menu="menu"
|
:menu="menu"
|
||||||
|
:activeMenu="activeMenu"
|
||||||
>
|
>
|
||||||
</sidebar-item>
|
</sidebar-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
|
|||||||
@ -28,7 +28,8 @@ const applicationRouter = {
|
|||||||
path: 'overview',
|
path: 'overview',
|
||||||
name: 'AppOverview',
|
name: 'AppOverview',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'Document',
|
icon: 'app-all-menu',
|
||||||
|
iconActive: 'app-all-menu-active',
|
||||||
title: '概览',
|
title: '概览',
|
||||||
active: 'overview',
|
active: 'overview',
|
||||||
parentPath: '/application/:id',
|
parentPath: '/application/:id',
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<el-button type="primary" text @click="copyClick(shareUrl)">
|
<el-button type="primary" text @click="copyClick(shareUrl)">
|
||||||
<el-icon style="font-size: 13px"><CopyDocument /></el-icon>
|
<AppIcon iconName="app-copy"></AppIcon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -37,14 +37,14 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<el-button type="primary" text>
|
<el-button type="primary" text>
|
||||||
<el-icon style="font-size: 13px"><CopyDocument /></el-icon>
|
<AppIcon iconName="app-copy"></AppIcon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<span class="vertical-middle lighter"> API Secret: ************** </span>
|
<span class="vertical-middle lighter"> API Secret: ************** </span>
|
||||||
<span>
|
<span>
|
||||||
<el-button type="primary" text>
|
<el-button type="primary" text>
|
||||||
<el-icon style="font-size: 13px"><CopyDocument /></el-icon>
|
<AppIcon iconName="app-copy"></AppIcon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog title="添加关联数据集" v-model="dialogVisible" width="600">
|
<el-dialog title="添加关联数据集" v-model="dialogVisible" width="600">
|
||||||
<template #header="{ close, titleId, titleClass }">
|
<template #header="{ titleId, titleClass }">
|
||||||
<div class="my-header flex">
|
<div class="my-header flex">
|
||||||
<h4 :id="titleId" :class="titleClass">添加关联数据集</h4>
|
<h4 :id="titleId" :class="titleClass">添加关联数据集</h4>
|
||||||
<el-button link class="ml-16" @click="refresh">
|
<el-button link class="ml-16" @click="refresh">
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
<div class="flex-between">
|
<div class="flex-between">
|
||||||
<span class="bold">复制以下代码进行嵌入</span>
|
<span class="bold">复制以下代码进行嵌入</span>
|
||||||
<el-button text @click="copyClick(source1)">
|
<el-button text @click="copyClick(source1)">
|
||||||
<el-icon style="font-size: 13px"><CopyDocument /></el-icon>
|
<AppIcon iconName="app-copy" ></AppIcon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-8">
|
<div class="mt-8">
|
||||||
@ -24,7 +24,7 @@
|
|||||||
<div class="flex-between">
|
<div class="flex-between">
|
||||||
<span class="bold">复制以下代码进行嵌入</span>
|
<span class="bold">复制以下代码进行嵌入</span>
|
||||||
<el-button text @click="copyClick(source2)">
|
<el-button text @click="copyClick(source2)">
|
||||||
<el-icon style="font-size: 13px"><CopyDocument /></el-icon>
|
<AppIcon iconName="app-copy"></AppIcon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-8">
|
<div class="mt-8">
|
||||||
|
|||||||
@ -3,33 +3,31 @@
|
|||||||
<div class="template-manage flex main-calc-height">
|
<div class="template-manage flex main-calc-height">
|
||||||
<div class="template-manage__left p-8 border-r">
|
<div class="template-manage__left p-8 border-r">
|
||||||
<h4 class="p-16">供应商</h4>
|
<h4 class="p-16">供应商</h4>
|
||||||
|
|
||||||
<common-list
|
<common-list
|
||||||
v-model="active_provider"
|
|
||||||
:data="provider_list"
|
:data="provider_list"
|
||||||
class="mt-8"
|
class="mt-8"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
|
@click="clickListHandle"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #default="{ row, index }">
|
||||||
<div class="flex">
|
<div class="flex" v-if="index === 0">
|
||||||
<AppIcon
|
<AppIcon
|
||||||
style="height: 24px; width: 24px"
|
|
||||||
class="mr-8"
|
class="mr-8"
|
||||||
:iconName="active_provider ? 'app-all-menu' : 'app-all-menu-active'"
|
style="height: 20px; width: 20px"
|
||||||
|
:iconName="active_provider === row ? 'app-all-menu-active' : 'app-all-menu'"
|
||||||
></AppIcon>
|
></AppIcon>
|
||||||
<span>全部模型</span>
|
<span>全部模型</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<div class="flex" v-else>
|
||||||
<template #default="{ row }">
|
<span :innerHTML="row.icon" alt="" style="height: 20px; width: 20px" class="mr-8" />
|
||||||
<div class="flex">
|
|
||||||
<span :innerHTML="row.icon" alt="" style="height: 24px; width: 24px" class="mr-8" />
|
|
||||||
<span>{{ row.name }}</span>
|
<span>{{ row.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</common-list>
|
</common-list>
|
||||||
</div>
|
</div>
|
||||||
<div class="template-manage__right p-24" v-loading="list_model_loading">
|
<div class="template-manage__right p-24" v-loading="list_model_loading">
|
||||||
<h3 v-if="active_provider">{{ active_provider.name }}</h3>
|
<h3>{{ active_provider?.name }}</h3>
|
||||||
<h3 v-else>全部模型</h3>
|
|
||||||
<div class="flex-between mt-8">
|
<div class="flex-between mt-8">
|
||||||
<el-button type="primary" @click="openCreateModel(active_provider)">创建模型</el-button>
|
<el-button type="primary" @click="openCreateModel(active_provider)">创建模型</el-button>
|
||||||
<el-input
|
<el-input
|
||||||
@ -67,6 +65,12 @@ import { splitArray } from '@/utils/common'
|
|||||||
import CreateModel from '@/views/template/component/CreateModel.vue'
|
import CreateModel from '@/views/template/component/CreateModel.vue'
|
||||||
import SelectProvider from '@/views/template/component/SelectProvider.vue'
|
import SelectProvider from '@/views/template/component/SelectProvider.vue'
|
||||||
|
|
||||||
|
const allObj = {
|
||||||
|
icon: '',
|
||||||
|
provider: '',
|
||||||
|
name: '全部模型'
|
||||||
|
}
|
||||||
|
|
||||||
const loading = ref<boolean>(false)
|
const loading = ref<boolean>(false)
|
||||||
|
|
||||||
const active_provider = ref<Provider>()
|
const active_provider = ref<Provider>()
|
||||||
@ -82,6 +86,11 @@ const model_split_list = computed(() => {
|
|||||||
const createModelRef = ref<InstanceType<typeof CreateModel>>()
|
const createModelRef = ref<InstanceType<typeof CreateModel>>()
|
||||||
const selectProviderRef = ref<InstanceType<typeof SelectProvider>>()
|
const selectProviderRef = ref<InstanceType<typeof SelectProvider>>()
|
||||||
|
|
||||||
|
const clickListHandle = (item: Provider) => {
|
||||||
|
active_provider.value = item
|
||||||
|
list_model()
|
||||||
|
}
|
||||||
|
|
||||||
const openCreateModel = (provider?: Provider) => {
|
const openCreateModel = (provider?: Provider) => {
|
||||||
if (provider) {
|
if (provider) {
|
||||||
createModelRef.value?.open(provider)
|
createModelRef.value?.open(provider)
|
||||||
@ -91,19 +100,17 @@ const openCreateModel = (provider?: Provider) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const list_model = () => {
|
const list_model = () => {
|
||||||
const params = active_provider.value ? { provider: active_provider.value.provider } : {}
|
const params = active_provider.value?.provider ? { provider: active_provider.value.provider } : {}
|
||||||
ModelApi.getModel({ ...model_search_form.value, ...params }, list_model_loading).then((ok) => {
|
ModelApi.getModel({ ...model_search_form.value, ...params }, list_model_loading).then((ok) => {
|
||||||
model_list.value = ok.data
|
model_list.value = ok.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(active_provider, list_model, {
|
|
||||||
immediate: true
|
|
||||||
})
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
ModelApi.getProvider(loading).then((ok) => {
|
ModelApi.getProvider(loading).then((ok) => {
|
||||||
provider_list.value = [...ok.data]
|
active_provider.value = allObj
|
||||||
|
provider_list.value = [allObj, ...ok.data]
|
||||||
|
list_model()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user