Skip to content

Commit

Permalink
show metadata table
Browse files Browse the repository at this point in the history
  • Loading branch information
xingyaoww committed Jan 15, 2025
1 parent 26b7ff1 commit 5f30388
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion frontend/src/state/chat-slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,20 @@ export const chatSlice = createSlice({
content = `${
causeMessage.content
}\n\nOutput:\n\`\`\`\n${content.trim() || "[Command finished execution with no output]"}\n\`\`\``;
causeMessage.content = content; // Observation content includes the action

// Only add metadata for 'run' observations
if (observationID === "run") {
const metadata = (observation.payload as CommandObservation).extras.metadata;

Check failure on line 170 in frontend/src/state/chat-slice.ts

View workflow job for this annotation

GitHub Actions / Lint frontend

Use object destructuring

Check failure on line 170 in frontend/src/state/chat-slice.ts

View workflow job for this annotation

GitHub Actions / Lint frontend

Insert `โŽยทยทยทยทยทยทยทยทยทยทยทยท`

Check failure on line 170 in frontend/src/state/chat-slice.ts

View workflow job for this annotation

GitHub Actions / Lint frontend

Use object destructuring

Check failure on line 170 in frontend/src/state/chat-slice.ts

View workflow job for this annotation

GitHub Actions / Lint frontend

Insert `โŽยทยทยทยทยทยทยทยทยทยทยทยท`
const metadataTable = Object.entries(metadata)
.map(([key, value]) => `- **${key}:** ${value}`)
.join("\n");
causeMessage.content = content;
causeMessage.content +=

Check failure on line 175 in frontend/src/state/chat-slice.ts

View workflow job for this annotation

GitHub Actions / Lint frontend

Replace `โŽยทยทยทยทยทยทยทยทยทยทยทยท"\n\nMetadata:\n\n"ยท+โŽยทยทยทยทยทยทยทยทยทยทยท` with `ยท"\n\nMetadata:\n\n"ยท+`

Check failure on line 175 in frontend/src/state/chat-slice.ts

View workflow job for this annotation

GitHub Actions / Lint frontend

Replace `โŽยทยทยทยทยทยทยทยทยทยทยทยท"\n\nMetadata:\n\n"ยท+โŽยทยทยทยทยทยทยทยทยทยทยท` with `ยท"\n\nMetadata:\n\n"ยท+`
"\n\nMetadata:\n\n" +
`${metadataTable}\n\n`;
} else {
causeMessage.content = content;
}
} else if (observationID === "read" || observationID === "edit") {
const { content } = observation.payload;
causeMessage.content = `\`\`\`${observationID === "edit" ? "diff" : "python"}\n${content}\n\`\`\``; // Content is already truncated by the ACI
Expand Down

0 comments on commit 5f30388

Please sign in to comment.