mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:02:46 +00:00
refactor: application add chat_background
This commit is contained in:
parent
2fccb9db67
commit
c3c6a551ae
|
|
@ -8,6 +8,8 @@ from application.api.application_api_key import ApplicationKeyCreateAPI
|
|||
from application.models import ApplicationApiKey
|
||||
from application.serializers.application_api_key import ApplicationKeySerializer
|
||||
from common.auth import TokenAuth
|
||||
from common.auth.authentication import has_permissions
|
||||
from common.constants.permission_constants import PermissionConstants
|
||||
from common.log.log import log
|
||||
from common.result import result, success
|
||||
|
||||
|
|
@ -34,10 +36,11 @@ class ApplicationKey(APIView):
|
|||
)
|
||||
@log(menu='Application', operate="Add ApiKey",
|
||||
get_operation_object=lambda r, k: get_application_operation_object(k.get('application_api_key_id')))
|
||||
def post(self,request: Request, application_id: str, workspace_id: str):
|
||||
@has_permissions(PermissionConstants.APPLICATION_OVERVIEW_API_KEY.get_workspace_application_permission())
|
||||
def post(self, request: Request, application_id: str, workspace_id: str):
|
||||
return result.success(ApplicationKeySerializer(
|
||||
data={'application_id': application_id, 'user_id': request.user.id,
|
||||
'workspace_id':workspace_id}).generate())
|
||||
data={'application_id': application_id, 'user_id': request.user.id,
|
||||
'workspace_id': workspace_id}).generate())
|
||||
|
||||
@extend_schema(
|
||||
methods=['GET'],
|
||||
|
|
@ -47,11 +50,11 @@ class ApplicationKey(APIView):
|
|||
parameters=ApplicationKeyCreateAPI.get_parameters(),
|
||||
tags=[_('Application Api Key')] # type: ignore
|
||||
)
|
||||
def get(self,request: Request, application_id: str, workspace_id: str):
|
||||
return result,success(ApplicationKeySerializer(
|
||||
data={'application_id':application_id, 'user_id':request.user.id,
|
||||
'workspace_id':workspace_id}).list())
|
||||
|
||||
@has_permissions(PermissionConstants.APPLICATION_OVERVIEW_API_KEY.get_workspace_application_permission())
|
||||
def get(self, request: Request, application_id: str, workspace_id: str):
|
||||
return result, success(ApplicationKeySerializer(
|
||||
data={'application_id': application_id, 'user_id': request.user.id,
|
||||
'workspace_id': workspace_id}).list())
|
||||
|
||||
class Operate(APIView):
|
||||
authentication_classes = [TokenAuth]
|
||||
|
|
@ -64,9 +67,6 @@ class ApplicationKey(APIView):
|
|||
parameters=ApplicationKeyCreateAPI.get_parameters(),
|
||||
tags=[_('Application Api Key')] # type: ignore
|
||||
)
|
||||
@has_permissions(PermissionConstants.APPLICATION_OVERVIEW_API_KEY.get_workspace_application_permission())
|
||||
def put(self, request: Request, application_id: str, workspace_id: str):
|
||||
return result.success(ApplicationKeySerializer.Operate(
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
return result.success(ApplicationKeySerializer.Operate())
|
||||
|
|
|
|||
|
|
@ -439,6 +439,10 @@ const defaultSetting = {
|
|||
show_history: true,
|
||||
draggable: true,
|
||||
show_guide: true,
|
||||
icon: '',
|
||||
icon_url: '',
|
||||
chat_background: '',
|
||||
chat_background_url: '',
|
||||
avatar: '',
|
||||
avatar_url: '',
|
||||
float_icon: '',
|
||||
|
|
@ -465,9 +469,13 @@ const xpackForm = ref<any>({
|
|||
show_source: false,
|
||||
show_exec: false,
|
||||
language: '',
|
||||
icon: '',
|
||||
icon_url: '',
|
||||
show_history: false,
|
||||
draggable: false,
|
||||
show_guide: false,
|
||||
chat_background: '',
|
||||
chat_background_url: '',
|
||||
avatar: '',
|
||||
avatar_url: '',
|
||||
float_icon: '',
|
||||
|
|
@ -491,7 +499,9 @@ const xpackForm = ref<any>({
|
|||
const imgUrl = ref<any>({
|
||||
avatar: '',
|
||||
float_icon: '',
|
||||
user_avatar: ''
|
||||
user_avatar: '',
|
||||
icon: '',
|
||||
chat_background: ''
|
||||
})
|
||||
|
||||
const dialogVisible = ref<boolean>(false)
|
||||
|
|
@ -511,7 +521,9 @@ function resetForm() {
|
|||
imgUrl.value = {
|
||||
avatar: '',
|
||||
float_icon: '',
|
||||
user_avatar: ''
|
||||
user_avatar: '',
|
||||
icon: '',
|
||||
chat_background: ''
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -538,6 +550,8 @@ const open = (data: any, content: any) => {
|
|||
xpackForm.value.draggable = data.draggable
|
||||
xpackForm.value.show_guide = data.show_guide
|
||||
imgUrl.value.avatar = data.avatar
|
||||
imgUrl.value.icon = data.icon
|
||||
imgUrl.value.chat_background = data.chat_background
|
||||
imgUrl.value.float_icon = data.float_icon
|
||||
imgUrl.value.user_avatar = data.user_avatar
|
||||
xpackForm.value.disclaimer = data.disclaimer
|
||||
|
|
@ -551,6 +565,8 @@ const open = (data: any, content: any) => {
|
|||
)
|
||||
}
|
||||
xpackForm.value.avatar_url = data.avatar
|
||||
xpackForm.value.chat_background_url = data.chat_background
|
||||
xpackForm.value.icon_url = data.icon
|
||||
xpackForm.value.user_avatar_url = data.user_avatar
|
||||
xpackForm.value.float_icon_url = data.float_icon
|
||||
xpackForm.value.show_avatar = data.show_avatar
|
||||
|
|
|
|||
Loading…
Reference in New Issue