mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: 去除无用代码
This commit is contained in:
parent
d9ce16946f
commit
28d44ac567
|
|
@ -8,7 +8,7 @@
|
|||
"""
|
||||
import time
|
||||
from abc import abstractmethod
|
||||
from typing import Type, Dict
|
||||
from typing import Type
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
|
|
|
|||
|
|
@ -10,16 +10,6 @@ from drf_yasg import openapi
|
|||
|
||||
from common.mixins.api_mixin import ApiMixin
|
||||
|
||||
"""
|
||||
name = serializers.CharField(required=True)
|
||||
desc = serializers.CharField(required=True)
|
||||
model_id = serializers.CharField(required=True)
|
||||
multiple_rounds_dialogue = serializers.BooleanField(required=True)
|
||||
prologue = serializers.CharField(required=True)
|
||||
example = serializers.ListSerializer(required=False, child=serializers.CharField(required=True))
|
||||
dataset_id_list = serializers.ListSerializer(required=False, child=serializers.UUIDField(required=True))
|
||||
"""
|
||||
|
||||
|
||||
class ApplicationApi(ApiMixin):
|
||||
class Authentication(ApiMixin):
|
||||
|
|
|
|||
|
|
@ -10,19 +10,12 @@ import traceback
|
|||
|
||||
from django.core import cache
|
||||
from django.core import signing
|
||||
from django.db.models import QuerySet
|
||||
from rest_framework.authentication import TokenAuthentication
|
||||
|
||||
from application.models.api_key_model import ApplicationAccessToken, ApplicationApiKey
|
||||
from common.auth.handle.impl.application_key import ApplicationKey
|
||||
from common.auth.handle.impl.public_access_token import PublicAccessToken
|
||||
from common.auth.handle.impl.user_token import UserToken
|
||||
from common.constants.authentication_type import AuthenticationType
|
||||
from common.constants.permission_constants import Auth, get_permission_list_by_role, RoleConstants, Permission, Group, \
|
||||
Operate
|
||||
from common.exception.app_exception import AppAuthenticationFailed, AppEmbedIdentityFailed, AppChatNumOutOfBoundsFailed
|
||||
from smartdoc.settings import JWT_AUTH
|
||||
from users.models.user import User, get_user_dynamics_permission
|
||||
|
||||
token_cache = cache.caches['token_cache']
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
@date:2023/10/23 16:03
|
||||
@desc:
|
||||
"""
|
||||
import types
|
||||
from smartdoc.const import CONFIG
|
||||
from langchain_community.embeddings import HuggingFaceEmbeddings
|
||||
|
||||
from smartdoc.const import CONFIG
|
||||
|
||||
|
||||
class EmbeddingModel:
|
||||
instance = None
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
@date:2023/10/31 18:03
|
||||
@desc:
|
||||
"""
|
||||
from typing import List, Dict
|
||||
from typing import Dict
|
||||
|
||||
from common.froms.base_field import BaseExecField, TriggerType
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
@date:2023/10/31 18:02
|
||||
@desc:
|
||||
"""
|
||||
from typing import List, Dict
|
||||
from typing import Dict
|
||||
|
||||
from common.froms.base_field import BaseExecField, TriggerType
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
@date:2023/11/1 14:48
|
||||
@desc:
|
||||
"""
|
||||
from typing import List, Dict
|
||||
from typing import Dict
|
||||
|
||||
from common.froms import BaseField, TriggerType
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
@date:2023/10/31 18:03
|
||||
@desc:
|
||||
"""
|
||||
from typing import List, Dict
|
||||
from typing import Dict
|
||||
|
||||
from common.froms.base_field import BaseExecField, TriggerType
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
@date:2023/10/31 18:01
|
||||
@desc:
|
||||
"""
|
||||
from typing import List, Dict
|
||||
from typing import Dict
|
||||
|
||||
from common.froms.base_field import TriggerType, BaseExecField
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
@date:2023/10/31 18:01
|
||||
@desc:
|
||||
"""
|
||||
from typing import List, Dict
|
||||
from typing import Dict
|
||||
|
||||
from common.froms.base_field import TriggerType, BaseExecField
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
@date:2023/10/31 17:58
|
||||
@desc:
|
||||
"""
|
||||
from typing import List, Dict
|
||||
from typing import Dict
|
||||
|
||||
from common.froms.base_field import BaseField, TriggerType
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
"""
|
||||
import logging
|
||||
import traceback
|
||||
from typing import Dict
|
||||
|
||||
from rest_framework.exceptions import ValidationError, ErrorDetail, APIException
|
||||
from rest_framework.views import exception_handler
|
||||
|
|
|
|||
|
|
@ -4,12 +4,11 @@ import re
|
|||
import traceback
|
||||
from functools import reduce
|
||||
from typing import List, Set
|
||||
import requests
|
||||
import html2text as ht
|
||||
from bs4 import BeautifulSoup
|
||||
from urllib.parse import urljoin, urlparse, ParseResult, urlsplit, parse_qs
|
||||
from urllib.parse import urljoin, urlparse, ParseResult, urlsplit
|
||||
|
||||
from common.exception.app_exception import AppApiException
|
||||
import html2text as ht
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
|
||||
|
|
|
|||
|
|
@ -7,17 +7,15 @@
|
|||
@desc:
|
||||
"""
|
||||
import base64
|
||||
import os
|
||||
import threading
|
||||
|
||||
from Crypto.Cipher import PKCS1_v1_5 as PKCS1_cipher
|
||||
from Crypto.PublicKey import RSA
|
||||
from django.db.models import QuerySet
|
||||
from django.core import cache
|
||||
from django.db.models import QuerySet
|
||||
|
||||
from setting.models import SystemSetting, SettingType
|
||||
|
||||
import threading
|
||||
|
||||
lock = threading.Lock()
|
||||
rsa_cache = cache.caches['default']
|
||||
cache_key = "rsa_key"
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@
|
|||
@date:2023/11/15 15:13
|
||||
@desc:
|
||||
"""
|
||||
import time
|
||||
from django.core import signing
|
||||
import hashlib
|
||||
import time
|
||||
|
||||
from django.core import signing
|
||||
from django.core.cache import cache
|
||||
|
||||
# alg使用的算法
|
||||
|
|
@ -75,5 +76,3 @@ def check_token(token):
|
|||
return False
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
token = create_token('zhangsan', 'lisi')
|
||||
|
|
|
|||
|
|
@ -11,13 +11,12 @@ import os
|
|||
import uuid
|
||||
from typing import Dict, List
|
||||
|
||||
from django.contrib.postgres.search import SearchVector
|
||||
from django.db.models import QuerySet
|
||||
from langchain_community.embeddings import HuggingFaceEmbeddings
|
||||
|
||||
from common.config.embedding_config import EmbeddingModel
|
||||
from common.db.search import native_search, generate_sql_by_query_dict
|
||||
from common.db.sql_execute import select_one, select_list
|
||||
from common.db.search import generate_sql_by_query_dict
|
||||
from common.db.sql_execute import select_list
|
||||
from common.util.file_util import get_file_content
|
||||
from embedding.models import Embedding, SourceType
|
||||
from embedding.vector.base_vector import BaseVectorStore
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
@date:2024/3/19 13:47
|
||||
@desc: 邮箱管理
|
||||
"""
|
||||
import uuid
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ from rest_framework.request import Request
|
|||
from rest_framework.views import APIView
|
||||
|
||||
from common.auth import TokenAuth, has_permissions
|
||||
from common.constants.permission_constants import PermissionConstants, RoleConstants
|
||||
from common.constants.permission_constants import RoleConstants
|
||||
from common.response import result
|
||||
from setting.serializers.system_setting import SystemSettingSerializer
|
||||
from setting.swagger_api.system_setting import SystemSettingEmailApi
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ const updateModel: (
|
|||
request: EditModelRequest,
|
||||
loading?: Ref<boolean>
|
||||
) => Promise<Result<Model>> = (model_id, request, loading) => {
|
||||
console.log(request)
|
||||
return put(`${prefix}/${model_id}`, request, {}, loading)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -447,7 +447,6 @@ function chatMessage(chat?: any, problem?: string) {
|
|||
applicationApi
|
||||
.postChatMessage(chartOpenId.value, chat.problem_text)
|
||||
.then((response) => {
|
||||
console.log(response.status)
|
||||
if (response.status === 401) {
|
||||
application
|
||||
.asyncAppAuthentication(accessToken)
|
||||
|
|
|
|||
|
|
@ -132,11 +132,9 @@ onMounted(() => {
|
|||
bus.on(key, (v: any) => {
|
||||
if (value && value.length > 0) {
|
||||
if (value.includes(v)) {
|
||||
console.log('符合情况,即将获取数据', key, v)
|
||||
props.trigger(props.formfield, loading)
|
||||
}
|
||||
} else {
|
||||
console.log('符合情况,即将获取数据', key, v)
|
||||
props.trigger(props.formfield, loading)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ const show = (field: FormField) => {
|
|||
for (const index in keys) {
|
||||
const key = keys[index]
|
||||
let v = _.get(formValue.value, key)
|
||||
console.log(v, key)
|
||||
if (v && v !== undefined && v !== null) {
|
||||
let values = field.relation_show_field_dict[key]
|
||||
if (values && values.length > 0) {
|
||||
|
|
@ -173,7 +172,6 @@ const render = (
|
|||
})
|
||||
}
|
||||
if (data) {
|
||||
console.log(data)
|
||||
formValue.value = data
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ instance.interceptors.response.use(
|
|||
return response
|
||||
},
|
||||
(err: any) => {
|
||||
console.log(err)
|
||||
if (err.code === 'ECONNABORTED') {
|
||||
MsgError(err.message)
|
||||
console.error(err)
|
||||
|
|
@ -218,9 +217,7 @@ export const exportExcel: (
|
|||
window.URL.revokeObjectURL(link.href)
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e)
|
||||
})
|
||||
.catch((e) => {})
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -90,8 +90,6 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
MsgSuccess('设置成功')
|
||||
dialogVisible.value = false
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!', fields)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -414,8 +414,6 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
router.push({ path: `/application` })
|
||||
})
|
||||
}
|
||||
} else {
|
||||
console.log('error submit!')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ const FormRef = ref()
|
|||
watch(
|
||||
() => props.data,
|
||||
(value) => {
|
||||
console.log(value)
|
||||
if (value && JSON.stringify(value) !== '{}') {
|
||||
form.value.name = value.name
|
||||
form.value.desc = value.desc
|
||||
|
|
|
|||
|
|
@ -105,9 +105,7 @@ function updateContent(data: any) {
|
|||
emit('update:data', newData.value)
|
||||
}
|
||||
|
||||
const handleClick = (tab: TabsPaneContext, event: Event) => {
|
||||
// console.log(tab, event)
|
||||
}
|
||||
const handleClick = (tab: TabsPaneContext, event: Event) => {}
|
||||
|
||||
onMounted(() => {})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -112,8 +112,6 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
} else {
|
||||
console.log('error submit!', fields)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -336,7 +336,6 @@ function changeState(bool: Boolean, row: any) {
|
|||
}
|
||||
|
||||
function editName(val: string) {
|
||||
console.log()
|
||||
if (val) {
|
||||
const obj = {
|
||||
name: val
|
||||
|
|
|
|||
|
|
@ -95,8 +95,6 @@ const submit = async (formEl: FormInstance | undefined, test?: string) => {
|
|||
MsgSuccess('设置成功')
|
||||
})
|
||||
}
|
||||
} else {
|
||||
console.log('error submit!')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,8 +180,6 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
|||
emit('refresh', res.data)
|
||||
dialogVisible.value = false
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!', fields)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,8 +135,6 @@ const submit = async (formEl: FormInstance) => {
|
|||
.then((res) => {
|
||||
dialogVisible.value = false
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,18 +126,10 @@ const submitMember = async (formEl: FormInstance | undefined) => {
|
|||
dialogVisible.value = false
|
||||
loading.value = false
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// const getUser = (val: string) => {
|
||||
// UserApi.getUserList(val, loading).then((res) => {
|
||||
// userOptions.value.push(res.data)
|
||||
// })
|
||||
// }
|
||||
|
||||
onMounted(() => {})
|
||||
|
||||
defineExpose({ open, close })
|
||||
|
|
|
|||
|
|
@ -136,7 +136,6 @@ const getModelForm = (model_name: string) => {
|
|||
).then((ok) => {
|
||||
model_form_field.value = ok.data
|
||||
if (modelValue.value) {
|
||||
console.log(modelValue.value.credential)
|
||||
// 渲染动态表单
|
||||
dynamicsFormRef.value?.render(model_form_field.value, modelValue.value.credential)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,8 +132,6 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
} else {
|
||||
console.log('error submit!', fields)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,8 +117,6 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
MsgSuccess('修改用户密码成功')
|
||||
dialogVisible.value = false
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!', fields)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue