* Convert the stream of chat response parts into something that can be rendered in the prompt.
(response: vscode.ChatResponseTurn)
| 179 | * Convert the stream of chat response parts into something that can be rendered in the prompt. |
| 180 | */ |
| 181 | function chatResponseToString(response: vscode.ChatResponseTurn): string { |
| 182 | return response.response |
| 183 | .map((r) => { |
| 184 | if (r instanceof vscode.ChatResponseMarkdownPart) { |
| 185 | return r.value.value; |
| 186 | } else if (r instanceof vscode.ChatResponseAnchorPart) { |
| 187 | if (r.value instanceof vscode.Uri) { |
| 188 | return r.value.fsPath; |
| 189 | } else { |
| 190 | return r.value.uri.fsPath; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | return ''; |
| 195 | }) |
| 196 | .join(''); |
| 197 | } |
| 198 | |
| 199 | interface PromptReferencesProps extends BasePromptElementProps { |
| 200 | references: ReadonlyArray<vscode.ChatPromptReference>; |