From 42be38b185660f2861b6ea89c1214368ef24e2eb Mon Sep 17 00:00:00 2001 From: "Dina Berry (personal)" Date: Tue, 24 Oct 2023 08:00:35 -0700 Subject: [PATCH] fix: fix tooltips for style and const (#87) * fix: fix for style and const * fix: add edit * fix: add changes as requested --- packages/webapp/src/i18n/tooltips.ts | 33 ++++ packages/webapp/src/pages/chat/Chat.tsx | 18 +- packages/webapp/src/pages/oneshot/OneShot.tsx | 173 ++++++++++-------- 3 files changed, 138 insertions(+), 86 deletions(-) create mode 100644 packages/webapp/src/i18n/tooltips.ts diff --git a/packages/webapp/src/i18n/tooltips.ts b/packages/webapp/src/i18n/tooltips.ts new file mode 100644 index 00000000..d5fc5210 --- /dev/null +++ b/packages/webapp/src/i18n/tooltips.ts @@ -0,0 +1,33 @@ +// Keep values less than 20 words. +// Don't add links to the tooltips. +export const toolTipText = { + approaches: 'Retrieve first uses Azure Search. Read first uses LangChain.', + promptTemplate: "Allows user to override the chatbot's prompt.", + promptTemplatePrefix: + "Allows user to provide a prefix to the chatbot's prompt. For example, `Answer the following question as if I were in high school.`", + promptTemplateSuffix: + "Allows user to provide a suffix to the chatbot's prompt. For example, `Return the first 50 words.`", + retrieveNumber: 'Number of results affecting final answer', + excludeCategory: 'Example categories include ...', + useSemanticRanker: + 'Semantic ranker is a machine learning model to improve the relevance and accuracy of search results.', + useQueryContextSummaries: + 'Can improve the relevance and accuracy of search results by providing a more concise and focused summary of the most relevant information related to the query or context.', + suggestFollowupQuestions: 'Provide follow-up questions to continue conversation.', + retrievalMode: + "The retrieval mode choices determine how the chatbot retrieves and ranks responses based on semantic similarity to the user's query. `Vectors + Text (Hybrid)` uses a combination of vector embeddings and text matching, `Vectors` uses only vector embeddings, and `Text` uses only text matching.", + streamChat: + 'Continuously deliver responses as they are generated or wait until all responses are generated before delivering them.', +}; + +// beak: triangle color +// beakCurtain: outer edge +// calloutMain: content center +// No style to control text color +export const toolTipTextCalloutProps = { + styles: { + beak: { background: '#D3D3D3' }, + beakCurtain: { background: '#D3D3D3' }, + calloutMain: { background: '#D3D3D3' }, + }, +}; diff --git a/packages/webapp/src/pages/chat/Chat.tsx b/packages/webapp/src/pages/chat/Chat.tsx index b826ddc8..b49ed83d 100644 --- a/packages/webapp/src/pages/chat/Chat.tsx +++ b/packages/webapp/src/pages/chat/Chat.tsx @@ -5,6 +5,7 @@ import { SettingsButton } from '../../components/SettingsButton/index.js'; import { Checkbox, DefaultButton, Dropdown, Panel, SpinButton, TextField, TooltipHost } from '@fluentui/react'; import type { IDropdownOption } from '@fluentui/react/lib-commonjs/Dropdown'; import 'chat-component'; +import { toolTipText, toolTipTextCalloutProps } from '../../i18n/tooltips.js'; const Chat = () => { const [isConfigPanelOpen, setIsConfigPanelOpen] = useState(false); @@ -105,9 +106,8 @@ const Chat = () => { onRenderFooterContent={() => setIsConfigPanelOpen(false)}>Close} isFooterAtBottom={true} > - + { /> - + { onChange={onRetrieveCountChange} /> - + - + { onChange={onUseSemanticRankerChange} /> - + { disabled={!useSemanticRanker} /> - + { onChange={onUseSuggestFollowupQuestionsChange} /> - + { onChange={onRetrievalModeChange} /> - + setIsConfigPanelOpen(false)}>Close} isFooterAtBottom={true} > - - - {(approach === Approaches.RetrieveThenRead || approach === Approaches.ReadDecomposeAsk) && ( - + - )} + - {approach === Approaches.ReadRetrieveRead && ( - <> - + {(approach === Approaches.RetrieveThenRead || approach === Approaches.ReadDecomposeAsk) && ( + - + )} - - - - - + {approach === Approaches.ReadRetrieveRead && ( + <> + + + + + + + + )} + + + + + + + + + + + + + + + );