Skip to content

Commit b519dae

Browse files
committed
Pass through actual message coming from the backend instead of generating our own text on the frontend
1 parent 6bdc463 commit b519dae

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

frontend/src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ function App() {
155155
});
156156
}
157157

158-
function completeUpload(filename: string) {
158+
function completeUpload(message: string) {
159159
addMessage({
160-
text: `File ${filename} was uploaded successfully.`,
160+
text: message,
161161
type: "message",
162162
role: "system",
163163
});
@@ -171,7 +171,7 @@ function App() {
171171
"Content-Type": "application/json",
172172
},
173173
body: JSON.stringify({
174-
prompt: `File ${filename} was uploaded successfully.`,
174+
prompt: message,
175175
}),
176176
})
177177
.then(() => {})

frontend/src/components/Input.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ export default function Input(props: { onSendMessage: any, onStartUpload: any, o
4343
body: formData,
4444
});
4545

46-
props.onCompletedUpload(file.name);
47-
4846
if (!response.ok) {
4947
throw new Error("Network response was not ok");
5048
}
49+
50+
const json = await response.json();
51+
props.onCompletedUpload(json["message"]);
52+
5153
} catch (error) {
5254
console.error("Error:", error);
5355
}

0 commit comments

Comments
 (0)