Skip to content

Commit 27d95b2

Browse files
Update components/google_gemini/actions/common/generate-content.mjs
Co-authored-by: michelle0927 <[email protected]>
1 parent 042c460 commit 27d95b2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

components/google_gemini/actions/common/generate-content.mjs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ export default {
5353
}
5454

5555
return history.map((itemStr) => {
56-
let item;
57-
try {
58-
item = JSON.parse(itemStr);
59-
} catch (e) {
60-
throw new ConfigurationError(`Invalid JSON in history item: ${itemStr}`);
56+
let item = itemStr;
57+
if (typeof item === "string") {
58+
try {
59+
item = JSON.parse(itemStr);
60+
} catch (e) {
61+
throw new ConfigurationError(`Invalid JSON in history item: ${itemStr}`);
62+
}
6163
}
6264

6365
if (!item.text || !item.role || ![

0 commit comments

Comments
 (0)