Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend multi-language support #1690 #1790

Merged
merged 31 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
785a2f6
WIP: Frontend multi-language support #1690
bnodir Jul 7, 2024
e786334
Merge remote-tracking branch 'origin/main' into multiLang
bnodir Jul 13, 2024
ed8c1e9
WIP(2): Merge branch 'main' into multiLang
bnodir Jul 13, 2024
f764afd
WIP(4): Implement language switching for File Upload Feature
bnodir Jul 15, 2024
028bf67
Playwright fail fix
bnodir Jul 17, 2024
300aa16
Merge with main
bnodir Jul 18, 2024
b98976c
Merge branch 'multiLang2' into multiLang
bnodir Jul 18, 2024
1c22ceb
Merge fix
bnodir Jul 18, 2024
89d9d70
Merge branch 'main' into multiLang
bnodir Jul 19, 2024
79a2f46
Use fluent dropdown and add label to language picker
pamelafox Jul 19, 2024
34b78a6
Use string instead of String
pamelafox Jul 19, 2024
869ec95
Pin mypy
pamelafox Jul 19, 2024
9663e71
Reflecting changes based on review comments
bnodir Jul 24, 2024
2d72aa9
Reflecting changes based on review comments-2
bnodir Jul 24, 2024
7b91210
Merge branch 'main' into multiLang
bnodir Jul 24, 2024
e78fae9
Make the language picker optional
bnodir Jul 24, 2024
c7d8fe3
Fixes in docs/deploy_features.md
bnodir Jul 25, 2024
40b367a
Revert changes made to package-lock.json
bnodir Jul 25, 2024
fa45ead
minor fix
bnodir Jul 26, 2024
a76dd94
Merge branch 'Azure-Samples:main' into multiLang
bnodir Aug 2, 2024
fa1bdd9
Merge branch 'Azure-Samples:main' into multiLang
bnodir Aug 7, 2024
de68265
minor fix
bnodir Aug 7, 2024
07b818e
Merge branch 'multiLang' of https://github.com/bnodir/azure-search-op…
bnodir Aug 7, 2024
679e4bb
Merge branch 'Azure-Samples:main' into multiLang
bnodir Aug 13, 2024
98bd2b1
Merge branch 'main' into multiLang
pamelafox Aug 13, 2024
235c9d9
Playwright fail fix
bnodir Aug 16, 2024
06b15f5
Merge branch 'multiLang' of https://github.com/bnodir/azure-search-op…
bnodir Aug 16, 2024
f7f0de3
Use the language value in the API payload
bnodir Aug 19, 2024
443e414
merge
bnodir Aug 27, 2024
bf091f1
merge
bnodir Aug 27, 2024
6620ee9
Merge branch 'main' into multiLang
pamelafox Aug 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .azdo/pipelines/azure-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ steps:
AZURE_COMPUTER_VISION_RESOURCE_GROUP: $(AZURE_COMPUTER_VISION_RESOURCE_GROUP)
AZURE_COMPUTER_VISION_LOCATION: $(AZURE_COMPUTER_VISION_LOCATION)
AZURE_COMPUTER_VISION_SKU: $(AZURE_COMPUTER_VISION_SKU)
ENABLE_LANGUAGE_PICKER: $(ENABLE_LANGUAGE_PICKER)
USE_SPEECH_INPUT_BROWSER: $(USE_SPEECH_INPUT_BROWSER)
USE_SPEECH_OUTPUT_BROWSER: $(USE_SPEECH_OUTPUT_BROWSER)
USE_SPEECH_OUTPUT_AZURE: $(USE_SPEECH_OUTPUT_AZURE)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/azure-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
USE_GPT4V: ${{ vars.USE_GPT4V }}
AZURE_VISION_ENDPOINT: ${{ vars.AZURE_VISION_ENDPOINT }}
VISION_SECRET_NAME: ${{ vars.VISION_SECRET_NAME }}
ENABLE_LANGUAGE_PICKER: ${{ vars.ENABLE_LANGUAGE_PICKER }}
USE_SPEECH_INPUT_BROWSER: ${{ vars.USE_SPEECH_INPUT_BROWSER }}
USE_SPEECH_OUTPUT_BROWSER: ${{ vars.USE_SPEECH_OUTPUT_BROWSER }}
USE_SPEECH_OUTPUT_AZURE: ${{ vars.USE_SPEECH_OUTPUT_AZURE }}
Expand Down
4 changes: 4 additions & 0 deletions app/backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
CONFIG_CREDENTIAL,
CONFIG_GPT4V_DEPLOYED,
CONFIG_INGESTER,
CONFIG_LANGUAGE_PICKER_ENABLED,
CONFIG_OPENAI_CLIENT,
CONFIG_SEARCH_CLIENT,
CONFIG_SEMANTIC_RANKER_DEPLOYED,
Expand Down Expand Up @@ -267,6 +268,7 @@ def config():
"showSemanticRankerOption": current_app.config[CONFIG_SEMANTIC_RANKER_DEPLOYED],
"showVectorOption": current_app.config[CONFIG_VECTOR_SEARCH_ENABLED],
"showUserUpload": current_app.config[CONFIG_USER_UPLOAD_ENABLED],
"showLanguagePicker": current_app.config[CONFIG_LANGUAGE_PICKER_ENABLED],
"showSpeechInput": current_app.config[CONFIG_SPEECH_INPUT_ENABLED],
"showSpeechOutputBrowser": current_app.config[CONFIG_SPEECH_OUTPUT_BROWSER_ENABLED],
"showSpeechOutputAzure": current_app.config[CONFIG_SPEECH_OUTPUT_AZURE_ENABLED],
Expand Down Expand Up @@ -429,6 +431,7 @@ async def setup_clients():

USE_GPT4V = os.getenv("USE_GPT4V", "").lower() == "true"
USE_USER_UPLOAD = os.getenv("USE_USER_UPLOAD", "").lower() == "true"
ENABLE_LANGUAGE_PICKER = os.getenv("ENABLE_LANGUAGE_PICKER", "").lower() == "true"
USE_SPEECH_INPUT_BROWSER = os.getenv("USE_SPEECH_INPUT_BROWSER", "").lower() == "true"
USE_SPEECH_OUTPUT_BROWSER = os.getenv("USE_SPEECH_OUTPUT_BROWSER", "").lower() == "true"
USE_SPEECH_OUTPUT_AZURE = os.getenv("USE_SPEECH_OUTPUT_AZURE", "").lower() == "true"
Expand Down Expand Up @@ -576,6 +579,7 @@ async def setup_clients():
current_app.config[CONFIG_SEMANTIC_RANKER_DEPLOYED] = AZURE_SEARCH_SEMANTIC_RANKER != "disabled"
current_app.config[CONFIG_VECTOR_SEARCH_ENABLED] = os.getenv("USE_VECTORS", "").lower() != "false"
current_app.config[CONFIG_USER_UPLOAD_ENABLED] = bool(USE_USER_UPLOAD)
current_app.config[CONFIG_LANGUAGE_PICKER_ENABLED] = ENABLE_LANGUAGE_PICKER
current_app.config[CONFIG_SPEECH_INPUT_ENABLED] = USE_SPEECH_INPUT_BROWSER
current_app.config[CONFIG_SPEECH_OUTPUT_BROWSER_ENABLED] = USE_SPEECH_OUTPUT_BROWSER
current_app.config[CONFIG_SPEECH_OUTPUT_AZURE_ENABLED] = USE_SPEECH_OUTPUT_AZURE
Expand Down
1 change: 1 addition & 0 deletions app/backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
CONFIG_SEARCH_CLIENT = "search_client"
CONFIG_OPENAI_CLIENT = "openai_client"
CONFIG_INGESTER = "ingester"
CONFIG_LANGUAGE_PICKER_ENABLED = "language_picker_enabled"
CONFIG_SPEECH_INPUT_ENABLED = "speech_input_enabled"
CONFIG_SPEECH_OUTPUT_BROWSER_ENABLED = "speech_output_browser_enabled"
CONFIG_SPEECH_OUTPUT_AZURE_ENABLED = "speech_output_azure_enabled"
Expand Down
176 changes: 175 additions & 1 deletion app/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions app/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@
"@fluentui/react-icons": "^2.0.249",
"@react-spring/web": "^9.7.3",
"dompurify": "^3.0.6",
"i18next": "^23.12.2",
"i18next-browser-languagedetector": "^8.0.0",
"i18next-http-backend": "^2.5.2",
"ndjson-readablestream": "^1.2.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-markdown": "^9.0.1",
"react-router-dom": "^6.23.1",
"react-helmet-async": "^2.0.5",
"react-i18next": "^15.0.0",
"react-syntax-highlighter": "^15.5.0",
"rehype-raw": "^7.0.0",
"remark-gfm": "^4.0.0",
Expand Down
2 changes: 2 additions & 0 deletions app/frontend/src/api/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export type ChatAppRequestOverrides = {
use_gpt4v?: boolean;
gpt4v_input?: GPT4VInput;
vector_fields: VectorFieldOptions[];
language: string;
};

export type ResponseMessage = {
Expand Down Expand Up @@ -84,6 +85,7 @@ export type Config = {
showSemanticRankerOption: boolean;
showVectorOption: boolean;
showUserUpload: boolean;
showLanguagePicker: boolean;
showSpeechInput: boolean;
showSpeechOutputBrowser: boolean;
showSpeechOutputAzure: boolean;
Expand Down
9 changes: 5 additions & 4 deletions app/frontend/src/components/AnalysisPanel/AnalysisPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Stack, Pivot, PivotItem } from "@fluentui/react";

import { useTranslation } from "react-i18next";
import styles from "./AnalysisPanel.module.css";

import { SupportingContent } from "../SupportingContent";
Expand Down Expand Up @@ -30,6 +30,7 @@ export const AnalysisPanel = ({ answer, activeTab, activeCitation, citationHeigh
const [citation, setCitation] = useState("");

const client = useLogin ? useMsal().instance : undefined;
const { t } = useTranslation();

const fetchCitation = async () => {
const token = client ? await getToken(client) : undefined;
Expand Down Expand Up @@ -78,21 +79,21 @@ export const AnalysisPanel = ({ answer, activeTab, activeCitation, citationHeigh
>
<PivotItem
itemKey={AnalysisPanelTabs.ThoughtProcessTab}
headerText="Thought process"
headerText={t("headerTexts.thoughtProcess")}
headerButtonProps={isDisabledThoughtProcessTab ? pivotItemDisabledStyle : undefined}
>
<ThoughtProcess thoughts={answer.context.thoughts || []} />
</PivotItem>
<PivotItem
itemKey={AnalysisPanelTabs.SupportingContentTab}
headerText="Supporting content"
headerText={t("headerTexts.supportingContent")}
headerButtonProps={isDisabledSupportingContentTab ? pivotItemDisabledStyle : undefined}
>
<SupportingContent supportingContent={answer.context.data_points} />
</PivotItem>
<PivotItem
itemKey={AnalysisPanelTabs.CitationTab}
headerText="Citation"
headerText={t("headerTexts.citation")}
headerButtonProps={isDisabledCitationTab ? pivotItemDisabledStyle : undefined}
>
{renderFileViewer()}
Expand Down
Loading
Loading