This commit is contained in:
liqiang-fit2cloud 2025-02-28 15:21:49 +08:00
commit 96b8898c05
9 changed files with 42 additions and 11 deletions

View File

@ -8,8 +8,10 @@
"""
from django.utils.translation import gettext_lazy as _
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework.decorators import action
from rest_framework.parsers import MultiPartParser
from rest_framework.request import Request
from rest_framework.views import APIView
@ -448,11 +450,28 @@ class ChatView(APIView):
class UploadFile(APIView):
authentication_classes = [TokenAuth]
parser_classes = [MultiPartParser]
@action(methods=['POST'], detail=False)
@swagger_auto_schema(operation_summary=_("Upload files"),
operation_id=_("Upload files"),
manual_parameters=ChatRecordApi.get_request_params_api(),
manual_parameters=[
openapi.Parameter(name='application_id',
in_=openapi.IN_PATH,
type=openapi.TYPE_STRING,
required=True,
description=_('Application ID')),
openapi.Parameter(name='chat_id',
in_=openapi.IN_PATH,
type=openapi.TYPE_STRING,
required=True,
description=_('Conversation ID')),
openapi.Parameter(name='file',
in_=openapi.IN_FORM,
type=openapi.TYPE_FILE,
required=True,
description=_('Upload file'))
],
tags=[_("Application/Conversation Log")]
)
@has_permissions(

View File

@ -62,7 +62,9 @@ class FileSerializer(serializers.Serializer):
def upload(self, with_valid=True):
if with_valid:
self.is_valid(raise_exception=True)
meta = self.data.get('meta', {'debug': True})
meta = self.data.get('meta', None)
if not meta:
meta = {'debug': True}
file_id = meta.get('file_id', uuid.uuid1())
file = File(id=file_id, file_name=self.data.get('file').name, meta=meta)
file.save(self.data.get('file').read())

View File

@ -55,7 +55,7 @@
/>
</g>
</svg>
<img v-else src="@/assets/logo/MaxKB-logo.svg" :height="height" />
<img src="@/assets/logo/MaxKB-logo.svg" :height="height" />
</template>
</template>
<script setup lang="ts">
@ -75,7 +75,7 @@ const isDefaultTheme = computed(() => {
})
const fileURL = computed(() => {
if (user.themeInfo?.loginLogo) {
if (user.themeInfo) {
if (typeof user.themeInfo?.loginLogo === 'string') {
return user.themeInfo?.loginLogo
} else {

View File

@ -1,4 +1,5 @@
import { hasPermission } from '@/utils/permission/index'
import NProgress from 'nprogress'
import {
createRouter,
createWebHistory,
@ -9,6 +10,7 @@ import {
} from 'vue-router'
import useStore from '@/stores'
import { routes } from '@/router/routes'
NProgress.configure({ showSpinner: false, speed: 500, minimum: 0.3 })
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: routes
@ -17,6 +19,7 @@ const router = createRouter({
// 路由前置拦截器
router.beforeEach(
async (to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext) => {
NProgress.start()
if (to.name === '404') {
next()
return
@ -48,6 +51,9 @@ router.beforeEach(
}
}
)
router.afterEach(() => {
NProgress.done()
})
export const getChildRouteListByPathAndName = (path: any, name?: RouteRecordName | any) => {
return getChildRouteList(routes, path, name)

View File

@ -11,7 +11,9 @@
margin: 0;
padding: 0;
}
[v-cloak] {
display: none !important;
}
html {
height: 100%;
box-sizing: border-box;

View File

@ -96,7 +96,7 @@
<el-input-number
v-model="form.dataset_setting.top_n"
:min="1"
:max="100"
:max="10000"
:value-on-clear="1"
controls-position="right"
class="w-full"

View File

@ -170,7 +170,7 @@
<el-input-number
v-model="cloneForm.top_number"
:min="1"
:max="100"
:max="10000"
controls-position="right"
class="w-full"
/>

View File

@ -1,5 +1,5 @@
<template>
<login-layout v-if="user.isEnterprise() ? user.themeInfo : true" v-loading="loading">
<login-layout v-if="!loading" v-loading="loading">
<LoginContainer :subTitle="user.themeInfo?.slogan || $t('views.system.theme.defaultSlogan')">
<h2 class="mb-24" v-if="!showQrCodeTab">{{ loginMode || $t('views.login.title') }}</h2>
<div v-if="!showQrCodeTab">
@ -225,10 +225,10 @@ const login = () => {
})
}
onMounted(() => {
onBeforeMount(() => {
loading.value = true
user.asyncGetProfile().then((res) => {
if (user.isEnterprise()) {
loading.value = true
user
.getAuthType()
.then((res) => {
@ -261,6 +261,8 @@ onMounted(() => {
}
})
.finally(() => (loading.value = false))
} else {
loading.value = false
}
})
})

View File

@ -49,7 +49,7 @@
<el-input-number
v-model="form.top_n"
:min="1"
:max="100"
:max="10000"
:value-on-clear="1"
controls-position="right"
class="w-full"