From 9eb2663f59f8610ed7950674846cabd3a8eee679 Mon Sep 17 00:00:00 2001 From: Jason Raitz Date: Wed, 10 Dec 2025 15:15:35 -0500 Subject: [PATCH 1/6] references redesign --- public/elements/tind-refs.jsx | 76 ++++++++++++++++++++++++++++++++++- willa/web/app.py | 2 +- 2 files changed, 75 insertions(+), 3 deletions(-) diff --git a/public/elements/tind-refs.jsx b/public/elements/tind-refs.jsx index fd1faa2..72f25df 100644 --- a/public/elements/tind-refs.jsx +++ b/public/elements/tind-refs.jsx @@ -6,13 +6,85 @@ import { } from "@/components/ui/accordion" export default function TindRefs () { + const parseTindRefference = (msg) => { + const ref = { + title: null, + interviewers: [], + interviewees: [], + project: null, + link: null, + }; + const lines = msg.split('\n').filter(line => line.trim() !== ''); + + lines.forEach(line => { + const parts = line.split(':'); + const key = parts[0].trim(); + const value = parts.slice(1).join(':').trim(); + + switch (key) { + case 'Title': + ref.title = value; + break; + case 'Contributor': + // if value ends in interviewee or interviewer, assign accordingly + if (value.endsWith(' interviewer')) { + ref.interviewers.push(value.replace(' interviewer', '').trim()); + } else if (value.endsWith(' interviewee')) { + ref.interviewees.push(value.replace(' interviewee', '').trim()); + } + break; + case 'Project Name': + ref.project = value; + break; + case 'Catalogue Link': + ref.link = value; + break; + } + }); + return ref; + }; + + let count = 0; + + + const buildTindMessage = () => { + originalMessage = props.tind_message || 'no references supplied'; + if (originalMessage === 'no references supplied') { + return originalMessage; + } + // Split message into parts by '___________' separator + const parts = originalMessage.split('___________'); + + const references = parts + .filter(part => part.trim() !== '') + .map(part => parseTindRefference(part)); + + count = references.length; + return ( +
+ {references.map((ref, index) => ( +
+ {ref.title} +

+ Interviewee(s): {ref.interviewees.join(' | ')}
+ Interviewer(s): {ref.interviewers.join(' | ')}
+ Project Name: {ref.project}
+

+ ___________ +
+ ))} +
+ ); + }; + const tindMessage = buildTindMessage(); + return ( - Metadata + References{count > 0 ? ` (${count})` : ''}

- {props.tind_message || 'no references supplied'} + {tindMessage}

diff --git a/willa/web/app.py b/willa/web/app.py index 767ecf6..722c65a 100644 --- a/willa/web/app.py +++ b/willa/web/app.py @@ -125,7 +125,7 @@ async def chat(message: cl.Message) -> None: ) msg = cl.Message( author='TIND', - content='References:', + content='', elements=[tind_refs], metadata={'tind_message': reply['tind_message']} ) From e414b54028eed7121b5726b95373df283e3eaec3 Mon Sep 17 00:00:00 2001 From: Jason Raitz <145712254+jason-raitz@users.noreply.github.com> Date: Thu, 11 Dec 2025 10:36:26 -0500 Subject: [PATCH 2/6] Update public/elements/tind-refs.jsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: maría a. matienzo <73732+anarchivist@users.noreply.github.com> --- public/elements/tind-refs.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/elements/tind-refs.jsx b/public/elements/tind-refs.jsx index 72f25df..19ee3c0 100644 --- a/public/elements/tind-refs.jsx +++ b/public/elements/tind-refs.jsx @@ -6,7 +6,7 @@ import { } from "@/components/ui/accordion" export default function TindRefs () { - const parseTindRefference = (msg) => { + const parseTindReference = (msg) => { const ref = { title: null, interviewers: [], From 6cf1f685f33069c2f85d7e3c814190e7344f3bbc Mon Sep 17 00:00:00 2001 From: Jason Raitz <145712254+jason-raitz@users.noreply.github.com> Date: Thu, 11 Dec 2025 10:36:33 -0500 Subject: [PATCH 3/6] Update public/elements/tind-refs.jsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: maría a. matienzo <73732+anarchivist@users.noreply.github.com> --- public/elements/tind-refs.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/elements/tind-refs.jsx b/public/elements/tind-refs.jsx index 19ee3c0..7f8e961 100644 --- a/public/elements/tind-refs.jsx +++ b/public/elements/tind-refs.jsx @@ -57,7 +57,7 @@ export default function TindRefs () { const references = parts .filter(part => part.trim() !== '') - .map(part => parseTindRefference(part)); + .map(part => parseTindReference(part)); count = references.length; return ( From 23986c0ddf489233b02e3c3b1dc3398475dc460e Mon Sep 17 00:00:00 2001 From: Jason Raitz <145712254+jason-raitz@users.noreply.github.com> Date: Thu, 11 Dec 2025 10:46:33 -0500 Subject: [PATCH 4/6] Update public/elements/tind-refs.jsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- public/elements/tind-refs.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/elements/tind-refs.jsx b/public/elements/tind-refs.jsx index 7f8e961..aa91ac9 100644 --- a/public/elements/tind-refs.jsx +++ b/public/elements/tind-refs.jsx @@ -48,7 +48,7 @@ export default function TindRefs () { const buildTindMessage = () => { - originalMessage = props.tind_message || 'no references supplied'; + const originalMessage = props.tind_message || 'no references supplied'; if (originalMessage === 'no references supplied') { return originalMessage; } From 548c7005af5b7b8ad17f9163d8a8c51904ead300 Mon Sep 17 00:00:00 2001 From: Jason Raitz <145712254+jason-raitz@users.noreply.github.com> Date: Thu, 11 Dec 2025 10:47:43 -0500 Subject: [PATCH 5/6] Update public/elements/tind-refs.jsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- public/elements/tind-refs.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/elements/tind-refs.jsx b/public/elements/tind-refs.jsx index aa91ac9..0aa4d5e 100644 --- a/public/elements/tind-refs.jsx +++ b/public/elements/tind-refs.jsx @@ -64,7 +64,11 @@ export default function TindRefs () {
{references.map((ref, index) => (
- {ref.title} + {ref.link && ref.link.trim() !== '' ? ( + {ref.title} + ) : ( + {ref.title} + )}

Interviewee(s): {ref.interviewees.join(' | ')}
Interviewer(s): {ref.interviewers.join(' | ')}
From c4812b6bcb4d15a2dfb256b4a64d5997158e9ea2 Mon Sep 17 00:00:00 2001 From: Jason Raitz Date: Thu, 11 Dec 2025 14:06:00 -0500 Subject: [PATCH 6/6] handling for empty reference keys --- public/elements/tind-refs.jsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/public/elements/tind-refs.jsx b/public/elements/tind-refs.jsx index 0aa4d5e..eb24646 100644 --- a/public/elements/tind-refs.jsx +++ b/public/elements/tind-refs.jsx @@ -66,13 +66,11 @@ export default function TindRefs () {

{ref.link && ref.link.trim() !== '' ? ( {ref.title} - ) : ( - {ref.title} - )} + ) : ({ref.title})}

- Interviewee(s): {ref.interviewees.join(' | ')}
- Interviewer(s): {ref.interviewers.join(' | ')}
- Project Name: {ref.project}
+ Interviewee(s): {ref.interviewees.join(' | ') || 'not listed'}
+ Interviewer(s): {ref.interviewers.join(' | ') || 'not listed'}
+ Project Name: {ref.project || 'not listed'}

___________