fix: enhance file handling and UI improvements in chat and file preview components

This commit is contained in:
dayuan.jiang
2025-11-10 10:28:37 +09:00
parent 93d02a8d44
commit ce45339c0d
4 changed files with 22 additions and 15 deletions

View File

@@ -28,12 +28,17 @@ export default function ChatPanel() {
} = useDiagram();
const onFetchChart = () => {
return new Promise<string>((resolve) => {
if (resolverRef && "current" in resolverRef) {
resolverRef.current = resolve; // Store the resolver
}
onExport(); // Trigger the export
});
return Promise.race([
new Promise<string>((resolve) => {
if (resolverRef && "current" in resolverRef) {
resolverRef.current = resolve;
}
onExport();
}),
new Promise<string>((_, reject) =>
setTimeout(() => reject(new Error("Chart export timed out after 10 seconds")), 10000)
)
]);
};
// Add a step counter to track updates
@@ -112,8 +117,6 @@ export default function ChatPanel() {
}
}, [messages]);
console.log(JSON.stringify(messages, null, 2));
const onFormSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (input.trim() && status !== "streaming") {