From 6d0cc9b6dc9a44f4ed4924e2066134e17887b2cc Mon Sep 17 00:00:00 2001 From: wangdl Date: Sat, 6 Jun 2026 15:45:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20GET=20/sessions=20@Body=20=E2=86=92=20@Q?= =?UTF-8?q?uery,=20=E4=BF=AE=E5=A4=8D=E5=AF=B9=E8=AF=9D=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GET 请求不应使用 @Body 装饰器(NestJS 默认不解析 GET body)。 Co-Authored-By: Claude Opus 4.7 --- src/modules/rag-chat/rag-chat.controller.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/rag-chat/rag-chat.controller.ts b/src/modules/rag-chat/rag-chat.controller.ts index 6a2f1ee..0c07e43 100644 --- a/src/modules/rag-chat/rag-chat.controller.ts +++ b/src/modules/rag-chat/rag-chat.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, Post, Delete, Body, Param, Res } from '@nestjs/common'; +import { Controller, Get, Post, Delete, Body, Param, Res, Query } from '@nestjs/common'; import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger'; import type { Response } from 'express'; import { RagChatService } from './rag-chat.service'; @@ -19,7 +19,7 @@ export class RagChatController { @Get('sessions') @ApiOperation({ summary: '对话列表' }) - async listSessions(@CurrentUser() user: UserPayload, @Body('knowledgeBaseId') kbId?: string) { + async listSessions(@CurrentUser() user: UserPayload, @Query('knowledgeBaseId') kbId?: string) { return this.svc.listSessions(String(user.id), kbId); }