From 01fa763faac76253e54670f704f23e5e2b7e0426 Mon Sep 17 00:00:00 2001 From: avo_even Date: Fri, 20 Dec 2024 16:32:23 +0100 Subject: [PATCH] Added functionality that redirects the user to specific page in citation in dataverse indexer, if pdf file --- DataverseIndexer/Conversational boosting.yml | 27 +++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/DataverseIndexer/Conversational boosting.yml b/DataverseIndexer/Conversational boosting.yml index f42b125..9ef2910 100644 --- a/DataverseIndexer/Conversational boosting.yml +++ b/DataverseIndexer/Conversational boosting.yml @@ -30,10 +30,10 @@ beginDialog: CountRows(Topic.Answer.Text.CitationSources) = 0, // Render the original answer Topic.Answer.Text.MarkdownContent, - + // If there are citations, rebuild the Markdown answer entirely Topic.Answer.Text.Content & Char(10) & Char(10) & - + // Concatenate citations in Markdown format Concat( Topic.Answer.Text.CitationSources, @@ -51,10 +51,24 @@ beginDialog: // Else use the returned URL Value. Url ) & - + With( + { + firstPos: Find("value=", Text) + 7, // we add 7 to make up for value=" + lastPos: Find(">", Text, 1) // find the closing bracket + }, + // only add "#page=" if brackets are found and document is pdf + If( + firstPos > 0 && lastPos > 0 && EndsWith(Lower(Name), ".pdf"), + + "#" & "page=" & Mid(Text, firstPos, (lastPos - firstPos) - 1), + "" //add nothing if not found + ) + ) + & + // Improve file name formatting " """ & - + // Extract the file name, remove query if present Substitute( If( @@ -64,14 +78,13 @@ beginDialog: ), "%20", " " ) - + & """", - + // Line breaks between citations Char(10) & Char(10) ) ) - - kind: SendActivity id: sendActivity_skwikk activity: "{Topic.FormattedAnswer}"