Skip to content

Commit 68ed209

Browse files
committed
fix: Interface parameters disappear after dialogue password authentication
1 parent dc170db commit 68ed209

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

apps/common/auth/handle/impl/chat_anonymous_user_token.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from common.constants.permission_constants import RoleConstants, Permission, Group, Operate, ChatAuth
1717
from common.database_model_manage.database_model_manage import DatabaseModelManage
1818
from common.exception.app_exception import AppAuthenticationFailed
19+
from maxkb.settings import edition
1920

2021

2122
class ChatAnonymousUserToken(AuthBaseHandle):
@@ -41,7 +42,7 @@ def handle(self, request, token: str, get_token_details):
4142
raise AppAuthenticationFailed(1002, _('Authentication information is incorrect'))
4243
if not application_access_token.access_token == access_token:
4344
raise AppAuthenticationFailed(1002, _('Authentication information is incorrect'))
44-
if application_access_token.authentication:
45+
if application_access_token.authentication and ['PE', 'EE'].__contains__(edition):
4546
if chat_user_token.authentication.auth_type != application_access_token.authentication_value.get('type',
4647
''):
4748
raise AppAuthenticationFailed(1002, _('Authentication information is incorrect'))

apps/common/job/clean_chat_job.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# coding=utf-8
22

3-
import logging
43
import datetime
54

5+
from apscheduler.schedulers.background import BackgroundScheduler
66
from django.db import transaction
7+
from django.db.models import Q, Max
78
from django.utils import timezone
8-
from apscheduler.schedulers.background import BackgroundScheduler
99
from django_apscheduler.jobstores import DjangoJobStore
10+
1011
from application.models import Application, Chat, ChatRecord
11-
from django.db.models import Q, Max
1212
from common.utils.lock import try_lock, un_lock, lock
1313
from common.utils.logger import maxkb_logger
14-
1514
from knowledge.models import File
1615

1716
scheduler = BackgroundScheduler()
@@ -25,7 +24,7 @@ def clean_chat_log_job():
2524
@lock(lock_key='clean_chat_log_job_execute', timeout=30)
2625
def clean_chat_log_job_lock():
2726
from django.utils.translation import gettext_lazy as _
28-
maxkb_logger.info(_('start clean chat log'))
27+
maxkb_logger.debug(_('start clean chat log'))
2928
now = timezone.now()
3029

3130
applications = Application.objects.all().values('id', 'clean_time')
@@ -71,7 +70,7 @@ def clean_chat_log_job_lock():
7170
if deleted_count < batch_size:
7271
break
7372

74-
maxkb_logger.info(_('end clean chat log'))
73+
maxkb_logger.debug(_('end clean chat log'))
7574

7675

7776
def run():

apps/common/job/clean_debug_file_job.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding=utf-8
2-
2+
import time
33
from datetime import timedelta
44

55
from apscheduler.schedulers.background import BackgroundScheduler
@@ -22,7 +22,7 @@ def clean_debug_file():
2222
@lock(lock_key='clean_debug_file_execute', timeout=30)
2323
def clean_debug_file_lock():
2424
from django.utils.translation import gettext_lazy as _
25-
maxkb_logger.info(_('start clean debug file'))
25+
maxkb_logger.debug(_('start clean debug file'))
2626
minutes_30_ago = timezone.now() - timedelta(minutes=30)
2727
two_hours_ago = timezone.now() - timedelta(hours=2)
2828
one_days_ago = timezone.now() - timedelta(hours=24)
@@ -31,7 +31,8 @@ def clean_debug_file_lock():
3131
Q(create_time__lt=one_days_ago, source_type=FileSourceType.TEMPORARY_1_DAY.value) |
3232
Q(create_time__lt=two_hours_ago, source_type=FileSourceType.TEMPORARY_120_MINUTE.value) |
3333
Q(create_time__lt=minutes_30_ago, source_type=FileSourceType.TEMPORARY_30_MINUTE.value)).delete()
34-
maxkb_logger.info(_('end clean debug file'))
34+
maxkb_logger.debug(_('end clean debug file'))
35+
time.sleep(2)
3536

3637

3738
def run():

apps/common/job/client_access_num_job.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
@date:2024/3/14 11:56
77
@desc:
88
"""
9-
import logging
109

1110
from apscheduler.schedulers.background import BackgroundScheduler
1211
from django.db.models import QuerySet
@@ -27,9 +26,9 @@ def client_access_num_reset_job():
2726
@lock(lock_key="access_num_reset_execute", timeout=30)
2827
def client_access_num_reset_job_lock():
2928
from django.utils.translation import gettext_lazy as _
30-
maxkb_logger.info(_('start reset access_num'))
29+
maxkb_logger.debug(_('start reset access_num'))
3130
QuerySet(ApplicationChatUserStats).update(intraday_access_num=0)
32-
maxkb_logger.info(_('end reset access_num'))
31+
maxkb_logger.debug(_('end reset access_num'))
3332

3433

3534
def run():

ui/src/views/chat-log/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
<el-table-column prop="mark_sum" :label="$t('views.chatLog.table.mark')" align="right" />
154154
<el-table-column prop="asker" :label="$t('views.chatLog.table.user')">
155155
<template #default="{ row }">
156-
{{ row.asker?.user_name }}
156+
{{ row.asker?.username }}
157157
</template>
158158
</el-table-column>
159159
<el-table-column :label="$t('views.chatLog.table.recenTimes')" width="180">

ui/src/views/chat/auth/component/password.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { ref, computed } from 'vue'
1313
import useStore from '@/stores'
1414
import { t } from '@/locales'
1515
import { useRoute, useRouter } from 'vue-router'
16+
const route = useRoute()
1617
const FormRef = ref()
1718
1819
const { chatUser } = useStore()
@@ -21,7 +22,7 @@ const router = useRouter()
2122
2223
const auth = () => {
2324
return chatUser.passwordAuthentication(form.value.password).then((ok) => {
24-
router.push({ name: 'chat', params: { accessToken: chatUser.accessToken } })
25+
router.push({ name: 'chat', params: { accessToken: chatUser.accessToken }, query: route.query })
2526
})
2627
}
2728
const validator_auth = (rule: any, value: string, callback: any) => {

0 commit comments

Comments
 (0)