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