mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-03 05:29:12 +00:00
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:
@@ -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(`) {
|
||||
|
||||
Reference in New Issue
Block a user