Add extract_document tool and improve artifacts tab scrolling

- Add extract_document tool for extracting text from PDF/DOCX/XLSX/PPTX from URLs
- CORS proxy support from settings for fetching documents
- Proper error messages guiding users on CORS issues and manual file attachment
- Add scroll-into-view for active artifact tabs
- Export extract_document tool from web-ui package
This commit is contained in:
Mario Zechner 2025-10-12 16:24:36 +02:00
parent f93e72a805
commit f8b98f7dac
5 changed files with 287 additions and 1 deletions

View file

@ -137,7 +137,8 @@ export class ArtifactsPanel extends LitElement {
ext === "css" ||
ext === "scss" ||
ext === "sass" ||
ext === "less"
ext === "less" ||
ext === "sh"
)
return "text";
// Everything else gets generic fallback
@ -218,6 +219,14 @@ export class ArtifactsPanel extends LitElement {
});
this._activeFilename = filename;
this.requestUpdate(); // Only for tab bar update
// Scroll the active tab into view after render
requestAnimationFrame(() => {
const activeButton = this.querySelector(`button[data-filename="${filename}"]`);
if (activeButton) {
activeButton.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" });
}
});
}
// Open panel and focus an artifact tab by filename
@ -617,6 +626,7 @@ export class ArtifactsPanel extends LitElement {
return html`
<button
class="px-3 py-2 whitespace-nowrap border-b-2 ${activeClass}"
data-filename="${a.filename}"
@click=${() => this.showArtifact(a.filename)}
>
<span class="font-mono text-xs">${a.filename}</span>