@@ -51,6 +51,21 @@ function transformChat(chat: {
5151 }
5252}
5353
54+ type CopilotChatListRow = Pick <
55+ typeof copilotChats . $inferSelect ,
56+ 'id' | 'title' | 'model' | 'createdAt' | 'updatedAt'
57+ >
58+
59+ function transformChatListItem ( chat : CopilotChatListRow ) {
60+ return {
61+ id : chat . id ,
62+ title : chat . title ,
63+ model : chat . model ,
64+ createdAt : chat . createdAt ,
65+ updatedAt : chat . updatedAt ,
66+ }
67+ }
68+
5469export async function GET ( req : NextRequest ) {
5570 try {
5671 const { searchParams } = new URL ( req . url )
@@ -166,9 +181,6 @@ export async function GET(req: NextRequest) {
166181 id : copilotChats . id ,
167182 title : copilotChats . title ,
168183 model : copilotChats . model ,
169- messages : copilotChats . messages ,
170- planArtifact : copilotChats . planArtifact ,
171- config : copilotChats . config ,
172184 createdAt : copilotChats . createdAt ,
173185 updatedAt : copilotChats . updatedAt ,
174186 } )
@@ -181,7 +193,7 @@ export async function GET(req: NextRequest) {
181193
182194 return NextResponse . json ( {
183195 success : true ,
184- chats : chats . map ( transformChat ) ,
196+ chats : chats . map ( transformChatListItem ) ,
185197 } )
186198 } catch ( error ) {
187199 logger . error ( 'Error fetching copilot chats:' , error )
0 commit comments