Fix storing code results on server and rendering them on web app

- Fix code context data type for validation on server. This would
  prevent the chat message from being written to history
- Handle null code results on web app
This commit is contained in:
Debanjum
2025-06-09 23:42:56 -07:00
parent b1a6e53d77
commit 64886cd0dd
3 changed files with 5 additions and 5 deletions

View File

@@ -129,7 +129,7 @@ export interface CodeContextData {
output_files: CodeContextFile[];
std_out: string;
std_err: string;
code_runtime: number;
code_runtime?: number;
};
}
@@ -454,7 +454,7 @@ const ChatMessage = forwardRef<HTMLDivElement, ChatMessageProps>((props, ref) =>
// Add code context files to the message
if (props.chatMessage.codeContext) {
Object.entries(props.chatMessage.codeContext).forEach(([key, value]) => {
value.results.output_files?.forEach((file) => {
value.results?.output_files?.forEach((file) => {
if (file.filename.endsWith(".png") || file.filename.endsWith(".jpg")) {
// Don't add the image again if it's already in the message!
if (!message.includes(`![${file.filename}](`)) {