aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA.J. Shulman <Shulman.aj@gmail.com>2024-07-16 16:11:19 -0400
committerA.J. Shulman <Shulman.aj@gmail.com>2024-07-16 16:11:19 -0400
commit6e0dd5cf8b36e66edbced83cf5e6d4e2e272be3f (patch)
treeca7eaef244399e2f8055ef6a6a46c255a7f8dd82
parent74666884d0680745146f4e4ca24573637ee0a391 (diff)
not sure why JSON parsing isn't working
-rw-r--r--src/client/views/nodes/ChatBox/ChatBox.tsx10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/client/views/nodes/ChatBox/ChatBox.tsx b/src/client/views/nodes/ChatBox/ChatBox.tsx
index 5d0a16b4f..c7ae9a354 100644
--- a/src/client/views/nodes/ChatBox/ChatBox.tsx
+++ b/src/client/views/nodes/ChatBox/ChatBox.tsx
@@ -158,10 +158,12 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
const currentLinkedDocs: Doc[] = this.linkedDocs;
const chunk_id = citation.chunk_id;
for (let doc of currentLinkedDocs) {
- console.log(JSON.parse(StrCast(doc.chunk_simpl)));
- const doc_chunk_simpl = JSON.parse(StrCast(doc.chunk_simpl));
- const text_chunks = doc_chunk_simpl.text_chunks as [{ chunk_id: string; start_page: number; end_page: number }];
- const image_chunks = doc_chunk_simpl.image_chunks as [{ chunk_id: string; location: string; page: number; page_width: number; page_height: number }];
+ //console.log(JSON.parse(StrCast(doc.chunk_simpl)));
+ console.log(JSON.stringify(StrCast(doc.chunk_simpl)));
+ const doc_chunk_simpl = JSON.parse(StrCast(doc.chunk_simpl) as string);
+ console.log(doc_chunk_simpl);
+ const text_chunks = doc_chunk_simpl.text_chunks as [{ chunk_id: string; start_page: number; end_page: number }] | [];
+ const image_chunks = doc_chunk_simpl.image_chunks as [{ chunk_id: string; location: string; page: number; page_width: number; page_height: number }] | [];
const found_text_chunk = text_chunks.find(chunk => chunk.chunk_id === chunk_id);
if (found_text_chunk) {