@@ -46,13 +46,6 @@ interface CredentialsPayload {
4646 }
4747}
4848
49- type MessageContent = string | Array < { type : string ; text ?: string ; [ key : string ] : unknown } >
50-
51- interface ConversationMessage {
52- role : string
53- content : MessageContent
54- }
55-
5649function buildProviderConfig ( selectedModel : string ) : CopilotProviderConfig | undefined {
5750 const defaults = getCopilotModel ( 'chat' )
5851 const envModel = env . COPILOT_MODEL || defaults . model
@@ -113,12 +106,10 @@ export async function buildCopilotRequestPayload(
113106 userId,
114107 userMessageId,
115108 mode,
116- conversationHistory = [ ] ,
117109 contexts,
118110 fileAttachments,
119111 commands,
120112 chatId,
121- implicitFeedback,
122113 } = params
123114
124115 const selectedModel = options . selectedModel
@@ -129,42 +120,6 @@ export async function buildCopilotRequestPayload(
129120
130121 const processedFileContents = await processFileAttachments ( fileAttachments ?? [ ] , userId )
131122
132- const messages : ConversationMessage [ ] = [ ]
133- for ( const msg of conversationHistory as Array < Record < string , unknown > > ) {
134- const msgAttachments = msg . fileAttachments as Array < Record < string , unknown > > | undefined
135- if ( Array . isArray ( msgAttachments ) && msgAttachments . length > 0 ) {
136- const content : Array < { type : string ; text ?: string ; [ key : string ] : unknown } > = [
137- { type : 'text' , text : msg . content as string } ,
138- ]
139- const processedHistoricalAttachments = await processFileAttachments (
140- ( msgAttachments as BuildPayloadParams [ 'fileAttachments' ] ) ?? [ ] ,
141- userId
142- )
143- for ( const fileContent of processedHistoricalAttachments ) {
144- content . push ( fileContent )
145- }
146- messages . push ( { role : msg . role as string , content } )
147- } else {
148- messages . push ( { role : msg . role as string , content : msg . content as string } )
149- }
150- }
151-
152- if ( implicitFeedback ) {
153- messages . push ( { role : 'system' , content : implicitFeedback } )
154- }
155-
156- if ( processedFileContents . length > 0 ) {
157- const content : Array < { type : string ; text ?: string ; [ key : string ] : unknown } > = [
158- { type : 'text' , text : message } ,
159- ]
160- for ( const fileContent of processedFileContents ) {
161- content . push ( fileContent )
162- }
163- messages . push ( { role : 'user' , content } )
164- } else {
165- messages . push ( { role : 'user' , content : message } )
166- }
167-
168123 const integrationTools : ToolSchema [ ] = [ ]
169124 let credentials : CredentialsPayload | null = null
170125
0 commit comments