Skip to content

Commit 82d93e8

Browse files
committed
refactor: move chat share endpoints to chat API routes and remove workspace_id from share-link flow
1 parent 2de3741 commit 82d93e8

File tree

5 files changed

+5
-13
lines changed

5 files changed

+5
-13
lines changed

apps/application/api/application_chat_link.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ def get_request():
2626
@staticmethod
2727
def get_parameters():
2828
return [
29-
OpenApiParameter(
30-
name="workspace_id",
31-
description="工作空间id",
32-
type=OpenApiTypes.STR,
33-
location='path',
34-
required=True,
35-
),
3629
OpenApiParameter(
3730
name="application_id",
3831
description="Application ID",

apps/application/serializers/application_chat_link.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def validate(self, attrs):
3535

3636
class ChatRecordShareLinkSerializer(serializers.Serializer):
3737
chat_id = serializers.UUIDField(required=True, label=_("Conversation ID"))
38-
workspace_id = serializers.CharField(required=False, allow_null=True, allow_blank=True, label=_("Workspace ID"))
3938
application_id = serializers.UUIDField(required=True, label=_("Application ID"))
4039
user_id = serializers.UUIDField(required=False, label=_("User ID"))
4140

apps/application/urls.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
path('workspace/<str:workspace_id>/application/<str:application_id>/chat', views.ApplicationChat.as_view()),
2525
path('workspace/<str:workspace_id>/application/<str:application_id>/chat/export', views.ApplicationChat.Export.as_view()),
2626
path('workspace/<str:workspace_id>/application/<str:application_id>/chat/<int:current_page>/<int:page_size>', views.ApplicationChat.Page.as_view()),
27-
path('workspace/<str:workspace_id>/application/<str:application_id>/chat/<str:chat_id>/share_chat', views.ChatRecordLinkView.as_view()),
2827
path('workspace/<str:workspace_id>/application/<str:application_id>/chat/<str:chat_id>/chat_record', views.ApplicationChatRecord.as_view()),
2928
path('workspace/<str:workspace_id>/application/<str:application_id>/chat/<str:chat_id>/chat_record/<str:chat_record_id>', views.ApplicationChatRecordOperateAPI.as_view()),
3029
path('workspace/<str:workspace_id>/application/<str:application_id>/chat/<str:chat_id>/chat_record/<int:current_page>/<int:page_size>', views.ApplicationChatRecord.Page.as_view()),
@@ -40,5 +39,4 @@
4039
path('workspace/<str:workspace_id>/application/<str:application_id>/mcp_tools', views.McpServers.as_view()),
4140
path('workspace/<str:workspace_id>/application/<str:application_id>/model/<str:model_id>/prompt_generate', views.PromptGenerateView.as_view()),
4241
path('chat_message/<str:chat_id>', views.ChatView.as_view()),
43-
path('chat/share/<str:link>', views.ChatRecordDetailView.as_view()),
4442
]

apps/application/views/application_chat_link.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ class ChatRecordLinkView(APIView):
3030
tags=[_("Chat record link")] # type: ignore
3131
)
3232

33-
def post(self, request: Request, workspace_id: str, application_id: str, chat_id: str):
33+
def post(self, request: Request, application_id: str, chat_id: str):
3434
return result.success(ChatRecordShareLinkSerializer(data={
35-
"workspace_id": workspace_id,
3635
"application_id": application_id,
3736
"chat_id": chat_id,
3837
"user_id": request.auth.chat_user_id

apps/chat/urls.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from django.urls import path
22

3+
from application.views import ChatRecordDetailView, ChatRecordLinkView
34
from chat.views.mcp import mcp_view
45
from . import views
56

@@ -24,5 +25,7 @@
2425
path('historical_conversation/clear',views.HistoricalConversationView.BatchDelete.as_view(), name='historical_conversation_clear'),
2526
path('historical_conversation/<str:chat_id>',views.HistoricalConversationView.Operate.as_view(), name='historical_conversation_operate'),
2627
path('historical_conversation_record/<str:chat_id>', views.HistoricalConversationRecordView.as_view(), name='historical_conversation_record'),
27-
path('historical_conversation_record/<str:chat_id>/<int:current_page>/<int:page_size>', views.HistoricalConversationRecordView.PageView.as_view(), name='historical_conversation_record')
28+
path('historical_conversation_record/<str:chat_id>/<int:current_page>/<int:page_size>', views.HistoricalConversationRecordView.PageView.as_view(), name='historical_conversation_record'),
29+
path('share/<str:link>', ChatRecordDetailView.as_view()),
30+
path('<str:application_id>/chat/<str:chat_id>/share_chat', ChatRecordLinkView.as_view()),
2831
]

0 commit comments

Comments
 (0)