Merge session-s3-files-tool into session-s3-query-table

This commit is contained in:
Guilhem Lemouel
2026-12-01 04:01:00 -08:00
2 changed files with 16 additions and 2 deletions
@@ -261,7 +261,19 @@ async fn read_s3_file(ctx: &Ctx<'_>, args: &Value) -> ToolResult {
fit_text(&mut out, content, length < size, csv_cut);
}
None => {
out.insert("preview_unavailable".into(), preview["msg"].clone());
// The endpoint's "Preview is not available" reads to a model as if the user
// could not see the file either, even while it is open in the side panel.
let reason = match preview["msg"].as_str() {
Some(m) if m.starts_with("Preview is not available") => {
"it is not a text, table or image file"
}
Some(m) => m,
None => "the server returned no content",
};
out.insert(
"content".into(),
format!("Not read by this tool: {reason}.").into(),
);
}
}
// The text preview reads no .jsonl or .ndjson, which query_s3_table does.
@@ -184,7 +184,9 @@ export function getStorageTools(): SessionTool<{}>[] {
const openS3File = (helpers as GlobalToolHelpers | undefined)?.openS3File
if (parsed.open_in_preview) {
if (openS3File) openS3File(file)
result.side_panel = openS3File ? 'opened' : 'this chat has no side panel'
result.side_panel = openS3File
? 'opened: the user now sees the file next to the chat'
: 'this chat has no side panel'
}
toolCallbacks.setToolStatus(toolId, {
content: `Read ${s3}${storageLabel(storage)}`,