Merge branch 'main' of github.com:maxkb-dev/maxkb

This commit is contained in:
shaohuzhang1 2023-12-04 16:33:25 +08:00
commit 8bc868becd
10 changed files with 109 additions and 137 deletions

View File

@ -18,7 +18,7 @@
placement="top" placement="top"
v-if="buttonData?.vote_status === '-1'" v-if="buttonData?.vote_status === '-1'"
> >
<el-button text @click="voteHandle('1')" :disabled="loading"> <el-button text @click="voteHandle('0')" :disabled="loading">
<AppIcon iconName="app-like"></AppIcon> <AppIcon iconName="app-like"></AppIcon>
</el-button> </el-button>
</el-tooltip> </el-tooltip>
@ -26,7 +26,7 @@
effect="dark" effect="dark"
content="取消赞同" content="取消赞同"
placement="top" placement="top"
v-if="buttonData?.vote_status === '1'" v-if="buttonData?.vote_status === '0'"
> >
<el-button text @click="voteHandle('-1')" :disabled="loading"> <el-button text @click="voteHandle('-1')" :disabled="loading">
<AppIcon iconName="app-like-color"></AppIcon> <AppIcon iconName="app-like-color"></AppIcon>
@ -39,7 +39,7 @@
placement="top" placement="top"
v-if="buttonData?.vote_status === '-1'" v-if="buttonData?.vote_status === '-1'"
> >
<el-button text @click="voteHandle('0')" :disabled="loading"> <el-button text @click="voteHandle('1')" :disabled="loading">
<AppIcon iconName="app-oppose"></AppIcon> <AppIcon iconName="app-oppose"></AppIcon>
</el-button> </el-button>
</el-tooltip> </el-tooltip>
@ -47,7 +47,7 @@
effect="dark" effect="dark"
content="取消反对" content="取消反对"
placement="top" placement="top"
v-if="buttonData?.vote_status === '0'" v-if="buttonData?.vote_status === '1'"
> >
<el-button text @click="voteHandle('-1')" :disabled="loading"> <el-button text @click="voteHandle('-1')" :disabled="loading">
<AppIcon iconName="app-oppose-color"></AppIcon> <AppIcon iconName="app-oppose-color"></AppIcon>

View File

@ -11,7 +11,7 @@
<div class="content"> <div class="content">
<el-card shadow="always" class="dialog-card"> <el-card shadow="always" class="dialog-card">
<h4>您好我是 {{ data?.name }}</h4> <h4>您好我是 {{ data?.name || '应用名称'}}</h4>
<div class="mt-4" v-if="data?.prologue"> <div class="mt-4" v-if="data?.prologue">
<el-text type="info">{{ data?.prologue }}</el-text> <el-text type="info">{{ data?.prologue }}</el-text>
</div> </div>

View File

@ -1,10 +1,5 @@
<template> <template>
<el-card <el-card shadow="always" class="card-box" @mouseenter="cardEnter()" @mouseleave="cardLeave()">
shadow="always"
class="card-box"
@mouseenter="cardEnter()"
@mouseleave="cardLeave()"
>
<div class="card-header"> <div class="card-header">
<slot name="header"> <slot name="header">
<div class="title flex align-center"> <div class="title flex align-center">
@ -17,7 +12,7 @@
</div> </div>
</slot> </slot>
</div> </div>
<div class="description mt-12"> <div class="description mt-12" v-if="$slots.description || description">
<slot name="description"> <slot name="description">
{{ description }} {{ description }}
</slot> </slot>

View File

@ -29,6 +29,7 @@
} }
.el-dialog { .el-dialog {
--el-dialog-title-font-size: 16px;
.dialog-sub-title { .dialog-sub-title {
color: var(--el-text-color-regular); color: var(--el-text-color-regular);
margin: 5px 0; margin: 5px 0;

View File

@ -9,8 +9,8 @@
> >
<template #header="{ close, titleId, titleClass }"> <template #header="{ close, titleId, titleClass }">
<el-breadcrumb separator=">"> <el-breadcrumb separator=">">
<el-breadcrumb-item <el-breadcrumb-item>
><span @click="toSelectProvider" class="select-provider" <span @click="toSelectProvider" class="select-provider"
>选择供应商</span >选择供应商</span
></el-breadcrumb-item ></el-breadcrumb-item
> >
@ -27,10 +27,17 @@
:render_data="model_form_field" :render_data="model_form_field"
:model="form_data" :model="form_data"
ref="dynamicsFormRef" ref="dynamicsFormRef"
label-position="top"
require-asterisk-position="right"
> >
<template #default> <template #default>
<el-form-item label="模型名称" prop="name" :rules="base_form_data_rule.name"> <el-form-item label="模型名称" prop="name" :rules="base_form_data_rule.name">
<el-input v-model="base_form_data.name" /> <el-input
v-model="base_form_data.name"
maxlength="20"
show-word-limit
placeholder="请给基础模型设置一个名称"
/>
</el-form-item> </el-form-item>
<el-form-item label="模型类型" prop="model_type" :rules="base_form_data_rule.model_type"> <el-form-item label="模型类型" prop="model_type" :rules="base_form_data_rule.model_type">
<el-select <el-select

View File

@ -11,7 +11,7 @@
<el-breadcrumb separator=">"> <el-breadcrumb separator=">">
<el-breadcrumb-item <el-breadcrumb-item
><span class="active-breadcrumb">{{ ><span class="active-breadcrumb">{{
`修改 ${providerValue?.name} 模型` `编辑 ${providerValue?.name} 模型`
}}</span></el-breadcrumb-item }}</span></el-breadcrumb-item
> >
</el-breadcrumb> </el-breadcrumb>
@ -22,10 +22,17 @@
:render_data="model_form_field" :render_data="model_form_field"
:model="form_data" :model="form_data"
ref="dynamicsFormRef" ref="dynamicsFormRef"
label-position="top"
require-asterisk-position="right"
> >
<template #default> <template #default>
<el-form-item label="模型名称" prop="name" :rules="base_form_data_rule.name"> <el-form-item label="模型名称" prop="name" :rules="base_form_data_rule.name">
<el-input v-model="base_form_data.name" /> <el-input
v-model="base_form_data.name"
maxlength="20"
show-word-limit
placeholder="请给基础模型设置一个名称"
/>
</el-form-item> </el-form-item>
<el-form-item label="模型类型" prop="model_type" :rules="base_form_data_rule.model_type"> <el-form-item label="模型类型" prop="model_type" :rules="base_form_data_rule.model_type">
<el-select <el-select

View File

@ -1,43 +1,35 @@
<template> <template>
<card-box <card-box :title="model.name" shadow="hover" class="model-card">
style="
--app-card-box-description-height: 100%;
--card-min-height: 153px;
--card-min-width: 20px;
width: 100%;
"
:title="model.name"
>
<template #icon> <template #icon>
<AppAvatar <span style="height: 32px; width: 32px" :innerHTML="icon" class="mr-12"></span>
class="mr-12"
shape="square"
style="--el-avatar-bg-color: rgba(255, 255, 255, 0)"
:size="32"
>
<span style="height: 24px; width: 24px" :innerHTML="icon"></span
></AppAvatar>
</template>
<template #description>
<el-descriptions :column="1" label-align="center">
<el-descriptions-item label="模型类型" label-class-name="ellipsis-1">
<span class="ellipsis-1"> {{ model.model_type }}</span></el-descriptions-item
>
<el-descriptions-item label="模型名称" label-class-name="ellipsis-1">
<span class="ellipsis-1">{{ model.model_name }}</span></el-descriptions-item
>
</el-descriptions>
</template> </template>
<div class="border-t mt-16">
<ul>
<li class="flex mt-16">
<el-text type="info">模型类型</el-text>
<span class="ellipsis-1 ml-16"> {{ model.model_type }}</span>
</li>
<li class="flex mt-12">
<el-text type="info">模型名称</el-text>
<span class="ellipsis-1 ml-16"> {{ model.model_name }}</span>
</li>
</ul>
</div>
<template #mouseEnter> <template #mouseEnter>
<el-tooltip effect="dark" content="修改" placement="top"> <div class="operation-button">
<el-button text @click.stop="openEditModel" class="edit-button"> <el-tooltip effect="dark" content="修改" placement="top">
<el-icon><Edit /></el-icon> </el-button <el-button text @click.stop="openEditModel">
></el-tooltip> <el-icon><EditPen /></el-icon>
<el-tooltip effect="dark" content="删除" placement="top"> </el-button>
<el-button text @click.stop="deleteModel" class="delete-button"> </el-tooltip>
<el-icon><Delete /></el-icon>
</el-button> <el-tooltip effect="dark" content="删除" placement="top">
</el-tooltip> <el-button text @click.stop="deleteModel">
<el-icon><Delete /></el-icon>
</el-button>
</el-tooltip>
</div>
</template> </template>
<EditModel ref="eidtModelRef" @submit="emit('change')"></EditModel> <EditModel ref="eidtModelRef" @submit="emit('change')"></EditModel>
</card-box> </card-box>
@ -77,20 +69,16 @@ const icon = computed(() => {
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.el-descriptions__cell) { .model-card {
display: flex; min-height: 153px;
flex-wrap: nowrap; .operation-button {
} position: absolute;
.delete-button { right: 12px;
position: absolute; top: 18px;
right: 12px; height: auto;
top: 18px; .el-button + .el-button {
height: auto; margin-left: 4px;
} }
.edit-button { }
position: absolute;
right: 30px;
top: 18px;
height: auto;
} }
</style> </style>

View File

@ -1,14 +0,0 @@
<template>
<el-row :gutter="12">
<el-col :span="12" v-for="data in data_list">
<el-card shadow="hover" @click="emit('update:modelValue', data)">
<slot v-bind="data"></slot>
</el-card>
</el-col>
</el-row>
</template>
<script setup lang="ts">
defineProps<{ modelValue?: any; data_list: Array<any> }>()
const emit = defineEmits(['update:modelValue'])
</script>
<style lang="scss" scoped></style>

View File

@ -6,34 +6,25 @@
:close-on-press-escape="false" :close-on-press-escape="false"
:destroy-on-close="true" :destroy-on-close="true"
:before-close="close" :before-close="close"
title="选择供应商"
> >
<template #header="{ close, titleId, titleClass }"> <el-row :gutter="12" v-loading="loading">
<el-breadcrumb separator=">"> <el-col :span="12" class="mb-16" v-for="(data, index) in list_provider" :key="index">
<el-breadcrumb-item> <el-card shadow="hover" @click="go_create(data)">
<span class="active-breadcrumb">选择供应商</span> <div class="flex align-center cursor">
</el-breadcrumb-item> <span :innerHTML="data.icon" alt="" style="height: 24px; width: 24px" class="mr-8" />
</el-breadcrumb> <span>{{ data.name }}</span>
</template> </div>
<RadioCard class="mb-8" :data_list="list_provider" @update:model-value="go_create" </el-card>
><template #default="scope"> </el-col>
<div class="center"> </el-row>
<span
:innerHTML="scope.icon"
alt=""
style="display: inline-block; height: 24px; width: 24px"
class="mr-8"
/>
<span>{{ scope.name }}</span>
</div>
</template></RadioCard
>
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import ModelApi from '@/api/model' import ModelApi from '@/api/model'
import type { Provider } from '@/api/type/model' import type { Provider } from '@/api/type/model'
import RadioCard from '@/views/template/component/RadioCard.vue'
const loading = ref<boolean>(false) const loading = ref<boolean>(false)
const dialogVisible = ref<boolean>(false) const dialogVisible = ref<boolean>(false)
const list_provider = ref<Array<Provider>>([]) const list_provider = ref<Array<Provider>>([])
@ -55,16 +46,4 @@ const go_create = (provider: Provider) => {
} }
defineExpose({ open, close }) defineExpose({ open, close })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped></style>
.active-breadcrumb {
font-size: 16px;
color: rgba(31, 35, 41, 1);
font-weight: 500;
line-height: 24px;
}
.center {
display: flex;
align-items: center;
cursor: pointer;
}
</style>

View File

@ -22,7 +22,7 @@
</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">
<h4>{{ active_provider?.name }}</h4> <h4>{{ active_provider?.name }}</h4>
<div class="flex-between mt-16 mb-8"> <div class="flex-between mt-16 mb-16">
<el-button type="primary" @click="openCreateModel(active_provider)">创建模型</el-button> <el-button type="primary" @click="openCreateModel(active_provider)">创建模型</el-button>
<el-input <el-input
v-model="model_search_form.name" v-model="model_search_form.name"
@ -32,25 +32,35 @@
class="w-240" class="w-240"
/> />
</div> </div>
<div class="model-list-height">
<el-row :gutter="15" v-for="(row, index) in model_split_list" :key="index"> <el-scrollbar>
<el-col <el-row v-if="model_split_list.length > 0" :gutter="15">
:xs="24" <template v-for="(row, index) in model_split_list" :key="index">
:sm="24" <el-col
:md="12" :xs="24"
:lg="12" :sm="24"
:xl="12" :md="12"
class="mt-8" :lg="12"
v-for="(model, i) in row" :xl="12"
:key="i" class="mb-16"
> v-for="(model, i) in row"
<ModelCard @change="list_model" :model="model" :provider_list="provider_list"> :key="i"
</ModelCard> >
</el-col> <ModelCard @change="list_model" :model="model" :provider_list="provider_list">
</el-row> </ModelCard>
</el-col>
</template>
</el-row>
<el-empty description="暂无数据" v-else />
</el-scrollbar>
</div>
</div> </div>
</div> </div>
<CreateModel ref="createModelRef" @submit="list_model"></CreateModel> <CreateModel
ref="createModelRef"
@submit="list_model"
@change="openCreateModel($event)"
></CreateModel>
<SelectProvider ref="selectProviderRef" @change="openCreateModel($event)"></SelectProvider> <SelectProvider ref="selectProviderRef" @change="openCreateModel($event)"></SelectProvider>
</LayoutContainer> </LayoutContainer>
@ -124,9 +134,8 @@ onMounted(() => {
width: var(--setting-left-width); width: var(--setting-left-width);
min-width: var(--setting-left-width); min-width: var(--setting-left-width);
} }
&__right { .model-list-height {
width: 100%; height: calc(var(--create-dataset-height) - 70px);
overflow: scroll;
} }
} }
</style> </style>