2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -51,9 +51,10 @@ Example Queries (IMPORTANT: Phrasing doesn't have to match):
51
51
) : Promise < RunnerResponse > {
52
52
// Check if the user included any code references in their last message
53
53
const lastMessage = messages [ messages . length - 1 ] ;
54
- const importantRefs = lastMessage . copilot_references . filter (
55
- ( ref ) => ref . type === "client.selection" || ref . type === "client.file"
56
- ) ;
54
+ let importantRefs : Reference [ ] = [ ] ;
55
+ if ( lastMessage . copilot_references ) {
56
+ importantRefs = lastMessage . copilot_references . filter ( ( ref ) => ref . type === "client.selection" || ref . type === "client.file" ) ;
57
+ }
57
58
58
59
const content = [
59
60
`The user has chosen to use the model named ${ args . model } .` ,
Original file line number Diff line number Diff line change @@ -224,6 +224,11 @@ const server = createServer(async (request, response) => {
224
224
response . end ( ) ;
225
225
} catch ( err ) {
226
226
console . error ( err ) ;
227
+
228
+ if ( ( err as any ) . response && ( err as any ) . response . status === 400 ) {
229
+ console . error ( 'Error 400:' , ( err as any ) . response . data ) ;
230
+ }
231
+
227
232
response . statusCode = 500
228
233
response . write ( "data: Something went wrong\n\n" )
229
234
response . end ( )
0 commit comments