Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 47 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,13 @@ pdf-extract = "0.10"
# stack) now lives in the tinychannels crate; the `whatsapp-web` feature forwards
# to `tinychannels/whatsapp-web`.
ppt-rs = "0.2.14"
# Native-Rust `.docx` writer for the `generate_document` tool (GH #4847).
# Pure Rust (no subprocess / managed runtime), MIT-licensed, actively
# maintained (2.8M downloads, last release 0.4.20 — Apr 2026). Mirrors the
# `ppt-rs` presentation engine: synthesise bytes in-process, hand them to
# the byte-agnostic artifact pipeline. `default-features` keeps the crate's
# image support (unused here, but avoids a bespoke feature list drifting).
docx-rs = "0.4.20"

[target.'cfg(windows)'.dependencies]
# Windows: tokio-tungstenite uses native-tls (schannel) so wss://
Expand Down
66 changes: 55 additions & 11 deletions app/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 1 addition & 24 deletions app/src/components/chat/ArtifactCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
saveArtifactViaDialog,
} from '../../services/artifactDownloadService';
import type { ArtifactSnapshot } from '../../store/chatRuntimeSlice';
import { extensionFor } from './artifactExtension';

/**
* Inline chat card surfacing a single agent-generated artifact (#2779).
Expand All @@ -33,30 +34,6 @@ export interface ArtifactCardProps {
onRetry?: (artifactId: string) => void;
}

/**
* Extension hint for the Tauri download command. Falls back to a
* lowercased kind slug when the title doesn't carry an explicit
* extension (defensive — `create_artifact` sanitises the title +
* extension separately, but a malformed title shouldn't crash the
* card).
*/
function extensionFor(kind: ArtifactSnapshot['kind'], title: string): string {
const dot = title.lastIndexOf('.');
if (dot > 0 && dot < title.length - 1) {
return title.slice(dot + 1).toLowerCase();
}
switch (kind) {
case 'presentation':
return 'pptx';
case 'document':
return 'pdf';
case 'image':
return 'png';
default:
return 'bin';
}
}

function KindIcon({ kind }: { kind: ArtifactSnapshot['kind'] }) {
const stroke = 'currentColor';
switch (kind) {
Expand Down
18 changes: 1 addition & 17 deletions app/src/components/chat/ChatFilesPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from '../../store/chatRuntimeSlice';
import { useAppDispatch } from '../../store/hooks';
import Button from '../ui/Button';
import { extensionFor } from './artifactExtension';

/**
* Popover panel listing every `ready` artifact for a thread (#3024).
Expand Down Expand Up @@ -76,23 +77,6 @@ function localizeErrorCode(
}
}

function extensionFor(kind: ArtifactSnapshot['kind'], title: string): string {
const dot = title.lastIndexOf('.');
if (dot > 0 && dot < title.length - 1) {
return title.slice(dot + 1).toLowerCase();
}
switch (kind) {
case 'presentation':
return 'pptx';
case 'document':
return 'pdf';
case 'image':
return 'png';
default:
return 'bin';
}
}

function KindIcon({ kind }: { kind: ArtifactSnapshot['kind'] }) {
const stroke = 'currentColor';
switch (kind) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/chat/__tests__/ArtifactCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe('ArtifactCard', () => {
});

it.each([
['document' as const, 'pdf'],
['document' as const, 'docx'],
['image' as const, 'png'],
['other' as const, 'bin'],
['presentation' as const, 'pptx'],
Expand Down
Loading
Loading