Skip to content

Commit

Permalink
feat: prevent empty request
Browse files Browse the repository at this point in the history
  • Loading branch information
darkskygit committed Apr 1, 2024
1 parent 3267c0a commit 6021184
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/backend/server/src/plugins/copilot/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export class CopilotController {
if (!session) {
throw new BadRequestException('Session not found');
}
if (!content || !content.trim()) {
throw new BadRequestException('Message is empty');
}
session.push({
role: 'user',
content: decodeURIComponent(content),
Expand Down Expand Up @@ -105,6 +108,9 @@ export class CopilotController {
if (!session) {
throw new BadRequestException('Session not found');
}
if (!content || !content.trim()) {
throw new BadRequestException('Message is empty');
}
session.push({
role: 'user',
content: decodeURIComponent(content),
Expand Down

0 comments on commit 6021184

Please sign in to comment.