Skip to content

Commit f16ff1b

Browse files
committed
fixed rewrite
1 parent c42e8be commit f16ff1b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/App.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,18 +250,18 @@ const AppContent = ({ isGenerating, setIsGenerating, isBookmarking, setIsBookmar
250250
}
251251
};
252252

253-
const handleTriggerRewrite = async (message) => {
253+
const handleTriggerRewrite = async (message, messageID = null, messageType = null) => {
254254
console.log("handleTriggerRewrite message received");
255255
setIsGenerating(true);
256256
navigate('/output');
257257
try {
258258
const result = await handleRewrite(message.text);
259259
const outputData = {
260-
id: uuidv4(),
260+
id: messageID || uuidv4(),
261261
input: message.text,
262262
text: result,
263263
timestamp: new Date().toISOString(),
264-
type: 'Composition'
264+
type: messageType || 'Composition'
265265
};
266266
await saveOutput(outputData);
267267
} catch (error) {

src/components/ui/OutputBox.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ const OutputBox = ({ handleTriggerRewrite, isGenerating }) => {
5454
setTimeout(() => setCopied(false), 2000);
5555
};
5656

57-
const handleRewrite = (text) => {
58-
handleTriggerRewrite(text);
57+
const handleRewrite = (text, id, type) => {
58+
handleTriggerRewrite(text, id, type);
5959
};
6060

6161
const handleDelete = async (id) => {
@@ -195,7 +195,7 @@ const OutputBox = ({ handleTriggerRewrite, isGenerating }) => {
195195
{copied ? <CheckIcon fontSize='small'/> : <ContentCopyIcon fontSize='small'/>}
196196
</IconButton>
197197
<IconButton
198-
onClick={() => handleRewrite(output.text)}
198+
onClick={() => handleRewrite(output.text, output.id, output.type)}
199199
sx={{
200200
color: '#1A73E8',
201201
padding: 0.5,

0 commit comments

Comments
 (0)