Skip to content

Commit 1dd7838

Browse files
committed
fix
1 parent 98cce69 commit 1dd7838

File tree

2 files changed

+13
-6
lines changed
  • apps/www/src/registry/app/api/ai/command
  • templates/plate-playground-template/src/app/api/ai/command

2 files changed

+13
-6
lines changed

apps/www/src/registry/app/api/ai/command/route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ import {
3030
} from './prompts';
3131

3232
export async function POST(req: NextRequest) {
33-
const { apiKey: key, ctx, messages: messagesRaw, model } = await req.json();
33+
const {
34+
apiKey: key,
35+
ctx,
36+
messages: messagesRaw = [],
37+
model,
38+
} = await req.json();
3439

3540
const { children, selection, toolName: toolNameParam } = ctx;
3641

templates/plate-playground-template/src/app/api/ai/command/route.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import type {
2-
ChatMessage,
3-
ToolName,
4-
} from '@/components/editor/use-chat';
1+
import type { ChatMessage, ToolName } from '@/components/editor/use-chat';
52
import type { NextRequest } from 'next/server';
63

74
import { createGateway } from '@ai-sdk/gateway';
@@ -30,7 +27,12 @@ import {
3027
} from './prompts';
3128

3229
export async function POST(req: NextRequest) {
33-
const { apiKey: key, ctx, messages: messagesRaw, model } = await req.json();
30+
const {
31+
apiKey: key,
32+
ctx,
33+
messages: messagesRaw = [],
34+
model,
35+
} = await req.json();
3436

3537
const { children, selection, toolName: toolNameParam } = ctx;
3638

0 commit comments

Comments
 (0)