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

View File

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

View File

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

View File

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

View File

@ -9,8 +9,8 @@
>
<template #header="{ close, titleId, titleClass }">
<el-breadcrumb separator=">">
<el-breadcrumb-item
><span @click="toSelectProvider" class="select-provider"
<el-breadcrumb-item>
<span @click="toSelectProvider" class="select-provider"
>选择供应商</span
></el-breadcrumb-item
>
@ -27,10 +27,17 @@
:render_data="model_form_field"
:model="form_data"
ref="dynamicsFormRef"
label-position="top"
require-asterisk-position="right"
>
<template #default>
<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 label="模型类型" prop="model_type" :rules="base_form_data_rule.model_type">
<el-select

View File

@ -11,7 +11,7 @@
<el-breadcrumb separator=">">
<el-breadcrumb-item
><span class="active-breadcrumb">{{
`修改 ${providerValue?.name} 模型`
`编辑 ${providerValue?.name} 模型`
}}</span></el-breadcrumb-item
>
</el-breadcrumb>
@ -22,10 +22,17 @@
:render_data="model_form_field"
:model="form_data"
ref="dynamicsFormRef"
label-position="top"
require-asterisk-position="right"
>
<template #default>
<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 label="模型类型" prop="model_type" :rules="base_form_data_rule.model_type">
<el-select

View File

@ -1,43 +1,35 @@
<template>
<card-box
style="
--app-card-box-description-height: 100%;
--card-min-height: 153px;
--card-min-width: 20px;
width: 100%;
"
:title="model.name"
>
<card-box :title="model.name" shadow="hover" class="model-card">
<template #icon>
<AppAvatar
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>
<span style="height: 32px; width: 32px" :innerHTML="icon" class="mr-12"></span>
</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>
<el-tooltip effect="dark" content="修改" placement="top">
<el-button text @click.stop="openEditModel" class="edit-button">
<el-icon><Edit /></el-icon> </el-button
></el-tooltip>
<el-tooltip effect="dark" content="删除" placement="top">
<el-button text @click.stop="deleteModel" class="delete-button">
<el-icon><Delete /></el-icon>
</el-button>
</el-tooltip>
<div class="operation-button">
<el-tooltip effect="dark" content="修改" placement="top">
<el-button text @click.stop="openEditModel">
<el-icon><EditPen /></el-icon>
</el-button>
</el-tooltip>
<el-tooltip effect="dark" content="删除" placement="top">
<el-button text @click.stop="deleteModel">
<el-icon><Delete /></el-icon>
</el-button>
</el-tooltip>
</div>
</template>
<EditModel ref="eidtModelRef" @submit="emit('change')"></EditModel>
</card-box>
@ -77,20 +69,16 @@ const icon = computed(() => {
})
</script>
<style lang="scss" scoped>
:deep(.el-descriptions__cell) {
display: flex;
flex-wrap: nowrap;
}
.delete-button {
position: absolute;
right: 12px;
top: 18px;
height: auto;
}
.edit-button {
position: absolute;
right: 30px;
top: 18px;
height: auto;
.model-card {
min-height: 153px;
.operation-button {
position: absolute;
right: 12px;
top: 18px;
height: auto;
.el-button + .el-button {
margin-left: 4px;
}
}
}
</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"
:destroy-on-close="true"
:before-close="close"
title="选择供应商"
>
<template #header="{ close, titleId, titleClass }">
<el-breadcrumb separator=">">
<el-breadcrumb-item>
<span class="active-breadcrumb">选择供应商</span>
</el-breadcrumb-item>
</el-breadcrumb>
</template>
<RadioCard class="mb-8" :data_list="list_provider" @update:model-value="go_create"
><template #default="scope">
<div class="center">
<span
:innerHTML="scope.icon"
alt=""
style="display: inline-block; height: 24px; width: 24px"
class="mr-8"
/>
<span>{{ scope.name }}</span>
</div>
</template></RadioCard
>
<el-row :gutter="12" v-loading="loading">
<el-col :span="12" class="mb-16" v-for="(data, index) in list_provider" :key="index">
<el-card shadow="hover" @click="go_create(data)">
<div class="flex align-center cursor">
<span :innerHTML="data.icon" alt="" style="height: 24px; width: 24px" class="mr-8" />
<span>{{ data.name }}</span>
</div>
</el-card>
</el-col>
</el-row>
</el-dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import ModelApi from '@/api/model'
import type { Provider } from '@/api/type/model'
import RadioCard from '@/views/template/component/RadioCard.vue'
const loading = ref<boolean>(false)
const dialogVisible = ref<boolean>(false)
const list_provider = ref<Array<Provider>>([])
@ -55,16 +46,4 @@ const go_create = (provider: Provider) => {
}
defineExpose({ open, close })
</script>
<style lang="scss" scoped>
.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>
<style lang="scss" scoped></style>

View File

@ -22,7 +22,7 @@
</div>
<div class="template-manage__right p-24" v-loading="list_model_loading">
<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-input
v-model="model_search_form.name"
@ -32,25 +32,35 @@
class="w-240"
/>
</div>
<el-row :gutter="15" v-for="(row, index) in model_split_list" :key="index">
<el-col
:xs="24"
:sm="24"
:md="12"
:lg="12"
:xl="12"
class="mt-8"
v-for="(model, i) in row"
:key="i"
>
<ModelCard @change="list_model" :model="model" :provider_list="provider_list">
</ModelCard>
</el-col>
</el-row>
<div class="model-list-height">
<el-scrollbar>
<el-row v-if="model_split_list.length > 0" :gutter="15">
<template v-for="(row, index) in model_split_list" :key="index">
<el-col
:xs="24"
:sm="24"
:md="12"
:lg="12"
:xl="12"
class="mb-16"
v-for="(model, i) in row"
:key="i"
>
<ModelCard @change="list_model" :model="model" :provider_list="provider_list">
</ModelCard>
</el-col>
</template>
</el-row>
<el-empty description="暂无数据" v-else />
</el-scrollbar>
</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>
</LayoutContainer>
@ -124,9 +134,8 @@ onMounted(() => {
width: var(--setting-left-width);
min-width: var(--setting-left-width);
}
&__right {
width: 100%;
overflow: scroll;
.model-list-height {
height: calc(var(--create-dataset-height) - 70px);
}
}
</style>