feat: 去除无用代码

This commit is contained in:
shaohuzhang1 2024-03-21 14:49:21 +08:00
parent d9ce16946f
commit 28d44ac567
36 changed files with 24 additions and 86 deletions

View File

@ -8,7 +8,7 @@
"""
import time
from abc import abstractmethod
from typing import Type, Dict
from typing import Type
from rest_framework import serializers

View File

@ -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):

View File

@ -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']

View File

@ -6,10 +6,10 @@
@date2023/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

View File

@ -6,7 +6,7 @@
@date2023/10/31 18:03
@desc:
"""
from typing import List, Dict
from typing import Dict
from common.froms.base_field import BaseExecField, TriggerType

View File

@ -6,7 +6,7 @@
@date2023/10/31 18:02
@desc:
"""
from typing import List, Dict
from typing import Dict
from common.froms.base_field import BaseExecField, TriggerType

View File

@ -6,7 +6,7 @@
@date2023/11/1 14:48
@desc:
"""
from typing import List, Dict
from typing import Dict
from common.froms import BaseField, TriggerType

View File

@ -6,7 +6,7 @@
@date2023/10/31 18:03
@desc:
"""
from typing import List, Dict
from typing import Dict
from common.froms.base_field import BaseExecField, TriggerType

View File

@ -6,7 +6,7 @@
@date2023/10/31 18:01
@desc:
"""
from typing import List, Dict
from typing import Dict
from common.froms.base_field import TriggerType, BaseExecField

View File

@ -6,7 +6,7 @@
@date2023/10/31 18:01
@desc:
"""
from typing import List, Dict
from typing import Dict
from common.froms.base_field import TriggerType, BaseExecField

View File

@ -6,7 +6,7 @@
@date2023/10/31 17:58
@desc:
"""
from typing import List, Dict
from typing import Dict
from common.froms.base_field import BaseField, TriggerType

View File

@ -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

View File

@ -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()

View File

@ -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"

View File

@ -6,9 +6,10 @@
@date2023/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')

View File

@ -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

View File

@ -6,7 +6,6 @@
@date2024/3/19 13:47
@desc: 邮箱管理
"""
import uuid
from django.db import models

View File

@ -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

View File

@ -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)
}

View File

@ -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)

View File

@ -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)
}
})

View File

@ -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
}
}

View File

@ -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) => {})
}
/**

View File

@ -90,8 +90,6 @@ const submit = async (formEl: FormInstance | undefined) => {
MsgSuccess('设置成功')
dialogVisible.value = false
})
} else {
console.log('error submit!', fields)
}
})
}

View File

@ -414,8 +414,6 @@ const submit = async (formEl: FormInstance | undefined) => {
router.push({ path: `/application` })
})
}
} else {
console.log('error submit!')
}
})
}

View File

@ -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

View File

@ -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>

View File

@ -112,8 +112,6 @@ const submit = async (formEl: FormInstance | undefined) => {
dialogVisible.value = false
})
}
} else {
console.log('error submit!', fields)
}
})
}

View File

@ -336,7 +336,6 @@ function changeState(bool: Boolean, row: any) {
}
function editName(val: string) {
console.log()
if (val) {
const obj = {
name: val

View File

@ -95,8 +95,6 @@ const submit = async (formEl: FormInstance | undefined, test?: string) => {
MsgSuccess('设置成功')
})
}
} else {
console.log('error submit!')
}
})
}

View File

@ -180,8 +180,6 @@ const submitForm = async (formEl: FormInstance | undefined) => {
emit('refresh', res.data)
dialogVisible.value = false
})
} else {
console.log('error submit!', fields)
}
})
}

View File

@ -135,8 +135,6 @@ const submit = async (formEl: FormInstance) => {
.then((res) => {
dialogVisible.value = false
})
} else {
console.log('error submit!')
}
})
}

View File

@ -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 })

View File

@ -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)
}

View File

@ -132,8 +132,6 @@ const submit = async (formEl: FormInstance | undefined) => {
dialogVisible.value = false
})
}
} else {
console.log('error submit!', fields)
}
})
}

View File

@ -117,8 +117,6 @@ const submit = async (formEl: FormInstance | undefined) => {
MsgSuccess('修改用户密码成功')
dialogVisible.value = false
})
} else {
console.log('error submit!', fields)
}
})
}