aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/views/nodes/chatbot/agentsystem/prompts.ts12
-rw-r--r--src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.scss6
-rw-r--r--src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx11
3 files changed, 18 insertions, 11 deletions
diff --git a/src/client/views/nodes/chatbot/agentsystem/prompts.ts b/src/client/views/nodes/chatbot/agentsystem/prompts.ts
index 7000d8634..01c30d444 100644
--- a/src/client/views/nodes/chatbot/agentsystem/prompts.ts
+++ b/src/client/views/nodes/chatbot/agentsystem/prompts.ts
@@ -22,8 +22,9 @@ export function getReactPrompt(tools: Tool[], summaries: () => string, chatHisto
<point>**STRUCTURE**: Always use the correct stage tags (e.g., <stage number="2" role="assistant">) for every response. Use only even-numbered stages for your responses.</point>
<point>**STOP after every stage and wait for input. Do not combine multiple stages in one response.**</point>
<point>If a tool is needed, select the most appropriate tool based on the query.</point>
- <point>**If one tool does not yield satisfactory results or fails twice, try another tool that might work better for the query.**</point>
+ <point>**If one tool does not yield satisfactory results or fails twice, try another tool that might work better for the query.** This often happens with the rag tool, which may not yeild great results. If this happens, try the search tool.</point>
<point>Ensure that **ALL answers follow the answer structure**: grounded text wrapped in <grounded_text> tags with corresponding citations, normal text in <normal_text> tags, and three follow-up questions at the end.</point>
+ <point>If you use a tool that will do something (i.e. creating a CSV), and want to also use a tool that will provide you with information (i.e. RAG), use the tool that will provide you with information first. Then proceed with the tool that will do something.</point>
</critical_points>
<thought_structure>
@@ -48,8 +49,9 @@ export function getReactPrompt(tools: Tool[], summaries: () => string, chatHisto
</action_input_structure>
<answer_structure>
+ ALL answers must follow this structure and everything must be witin the <answer> tag:
<answer>
- <grounded_text> - All information derived from tools or user documents must be wrapped in these tags with proper citation.</grounded_text>
+ <grounded_text> - All information derived from tools or user documents must be wrapped in these tags with proper citation. This should not be word for word, but paraphrased from the text.</grounded_text>
<normal_text> - Use this tag for text not derived from tools or user documents. It should only be for narrative-like text or extremely common knowledge information.</normal_text>
<citations>
<citation> - Provide proper citations for each <grounded_text>, referencing the tool or document chunk used. ENSURE THAT THERE IS A CITATION WHOSE INDEX MATCHES FOR EVERY GROUNDED TEXT CITATION INDEX. </citation>
@@ -65,6 +67,10 @@ export function getReactPrompt(tools: Tool[], summaries: () => string, chatHisto
<step>Ensure that **EVERY** <grounded_text> tag includes a citation index aligned with a citation that you provide that references the source of the information.</step>
<step>There should be a one-to-one relationship between <grounded_text> tags and citations.</step>
<step>Over-citing is discouraged—only cite the information that is directly relevant to the user's query.</step>
+ <step>Paraphrase the information in the <grounded_text> tags, but ensure that the meaning is preserved.</step>
+ <step>Do not include the full text of the chunk in the citation—only the relevant excerpt.</step>
+ <step>For text chunks, the citation content must reflect the exact subset of the original chunk that is relevant to the grounded_text tag.</step>
+ <step>Do not use citations from previous interactions. Only use citations from the current action loop.</step>
</grounded_text_guidelines>
<normal_text_guidelines>
@@ -130,7 +136,7 @@ export function getReactPrompt(tools: Tool[], summaries: () => string, chatHisto
<stage number="6" role="assistant">
<thought>
- With key moments from the World Cup retrieved, I will now use the website scraper tool to gather data on Qatar’s tourism impact during the World Cup.
+ With key moments from the World Cup retrieved, I will now use the website scraper tool to gather data on Qatar's tourism impact during the World Cup.
</thought>
<action>websiteInfoScraper</action>
</stage>
diff --git a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.scss b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.scss
index 42f6a0d61..50111f678 100644
--- a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.scss
+++ b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.scss
@@ -93,6 +93,7 @@ $transition: all 0.3s ease;
display: flex;
align-items: center;
justify-content: center;
+ position: relative;
&:hover {
background-color: darken($primary-color, 10%);
@@ -109,10 +110,7 @@ $transition: all 0.3s ease;
border: 3px solid rgba(255, 255, 255, 0.3);
border-top: 3px solid #fff;
border-radius: 50%;
- animation: spin 1s linear infinite;
- display: flex;
- align-items: center;
- justify-content: center;
+ animation: spin 2s linear infinite;
}
}
}
diff --git a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
index 28bfbeae3..d4deff78b 100644
--- a/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
+++ b/src/client/views/nodes/chatbot/chatboxcomponents/ChatBox.tsx
@@ -23,6 +23,8 @@ import { ClientUtils } from '../../../../../ClientUtils';
import { ProgressBar } from './ProgressBar';
import { DocumentView } from '../../DocumentView';
import { Networking } from '../../../../Network';
+import { PDFViewer } from '../../../pdf/PDFViewer';
+import { PDFBox } from '../../PDFBox';
dotenv.config();
@@ -225,9 +227,9 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
* Scrolls the chat messages container to the bottom, ensuring the latest message is visible.
*/
scrollToBottom = () => {
- if (this.messagesRef.current) {
- this.messagesRef.current.scrollTop = this.messagesRef.current.scrollHeight;
- }
+ // if (this.messagesRef.current) {
+ // this.messagesRef.current.scrollTop = this.messagesRef.current.scrollHeight;
+ // }
};
/**
@@ -445,7 +447,8 @@ export class ChatBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
DocumentManager.Instance.showDocument(doc, { willZoomCentered: true }, () => {
const firstView = Array.from(doc[DocViews])[0] as DocumentView;
- firstView.ComponentView?.search?.(citation.direct_text ?? '');
+ (firstView.ComponentView as PDFBox)?.gotoPage?.(foundChunk.startPage);
+ (firstView.ComponentView as PDFBox)?.search?.(citation.direct_text ?? '');
});
break;
case CHUNK_TYPE.URL: