修改配置文件
This commit is contained in:
parent
eb7884c1b5
commit
a9156bf037
@ -11,10 +11,12 @@ import uuid
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
from urllib.parse import parse_qs
|
from urllib.parse import parse_qs
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from rest_framework.permissions import IsAuthenticated
|
||||||
|
from apps.user.authentication import CustomTokenAuthentication
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class ChatStreamConsumer(AsyncWebsocketConsumer):
|
class ChatStreamConsumer(AsyncWebsocketConsumer):
|
||||||
|
|
||||||
# 固定知识库ID
|
# 固定知识库ID
|
||||||
DEFAULT_KNOWLEDGE_BASE_ID = "b680a4fa-37be-11f0-a7cb-0242ac120002"
|
DEFAULT_KNOWLEDGE_BASE_ID = "b680a4fa-37be-11f0-a7cb-0242ac120002"
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ from rest_framework.decorators import action
|
|||||||
from apps.user.models import User
|
from apps.user.models import User
|
||||||
from apps.chat.models import ChatHistory
|
from apps.chat.models import ChatHistory
|
||||||
from apps.chat.serializers import ChatHistorySerializer
|
from apps.chat.serializers import ChatHistorySerializer
|
||||||
|
from apps.user.authentication import CustomTokenAuthentication
|
||||||
from apps.common.services.chat_service import ChatService
|
from apps.common.services.chat_service import ChatService
|
||||||
from apps.chat.services.chat_api import (
|
from apps.chat.services.chat_api import (
|
||||||
ExternalAPIError, stream_chat_answer, get_chat_answer,
|
ExternalAPIError, stream_chat_answer, get_chat_answer,
|
||||||
@ -22,6 +23,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class ChatHistoryViewSet(viewsets.ModelViewSet):
|
class ChatHistoryViewSet(viewsets.ModelViewSet):
|
||||||
permission_classes = [IsAuthenticated]
|
permission_classes = [IsAuthenticated]
|
||||||
|
authentication_classes = [CustomTokenAuthentication]
|
||||||
serializer_class = ChatHistorySerializer
|
serializer_class = ChatHistorySerializer
|
||||||
queryset = ChatHistory.objects.all()
|
queryset = ChatHistory.objects.all()
|
||||||
|
|
||||||
|
14
apps/daren_detail/migrations/0005_merge_20250523_1923.py
Normal file
14
apps/daren_detail/migrations/0005_merge_20250523_1923.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Generated by Django 5.1.5 on 2025-05-23 11:23
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('daren_detail', '0004_creatorprofile_avatar'),
|
||||||
|
('daren_detail', '0004_creatorprofile_profile'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
]
|
@ -49,8 +49,8 @@ INSTALLED_APPS = [
|
|||||||
"apps.brands.apps.BrandsConfig",
|
"apps.brands.apps.BrandsConfig",
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'rest_framework_simplejwt',
|
'rest_framework_simplejwt',
|
||||||
'apps.chat.apps.ChatConfig',
|
"apps.chat.apps.ChatConfig",
|
||||||
'apps.common.apps.CommonConfig',
|
"apps.common.apps.CommonConfig",
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
@ -102,7 +102,7 @@ DATABASES = {
|
|||||||
'NAME': 'daren_detail',
|
'NAME': 'daren_detail',
|
||||||
'USER': 'root',
|
'USER': 'root',
|
||||||
'PASSWORD': '123456',
|
'PASSWORD': '123456',
|
||||||
'HOST': '192.168.31.138',
|
'HOST': 'localhost',
|
||||||
'PORT': '3306',
|
'PORT': '3306',
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'charset': 'utf8mb4',
|
'charset': 'utf8mb4',
|
||||||
@ -215,13 +215,9 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|||||||
|
|
||||||
# REST Framework 设置
|
# REST Framework 设置
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
'DEFAULT_AUTHENTICATION_CLASSES': [
|
'DEFAULT_AUTHENTICATION_CLASSES': [], # 默认不需要认证
|
||||||
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
'DEFAULT_PERMISSION_CLASSES': [], # 默认不需要权限
|
||||||
'apps.user.authentication.CustomTokenAuthentication',
|
'UNAUTHENTICATED_USER': None
|
||||||
],
|
|
||||||
'DEFAULT_PERMISSION_CLASSES': [
|
|
||||||
'rest_framework.permissions.IsAuthenticated',
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# JWT 设置
|
# JWT 设置
|
||||||
@ -241,5 +237,4 @@ SIMPLE_JWT = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
API_BASE_URL = 'http://81.69.223.133:48329'
|
API_BASE_URL = 'http://81.69.223.133:48329'
|
||||||
SILICON_CLOUD_API_KEY = 'sk-xqbujijjqqmlmlvkhvxeogqjtzslnhdtqxqgiyuhwpoqcjvf'
|
SILICON_CLOUD_API_KEY = 'sk-xqbujijjqqmlmlvkhvxeogqjtzslnhdtqxqgiyuhwpoqcjvf'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user