From 3ffe19eba1536c33a37ae14d305656bbbe05fb18 Mon Sep 17 00:00:00 2001 From: WenjiaoYue Date: Thu, 27 Jun 2024 14:44:37 +0800 Subject: [PATCH] Modify the corresponding format according to the backend new structure. (#326) * Modify the corresponding format according to the backend new structure. Signed-off-by: Yue, Wenjiao * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update +page.svelte * Update +page.svelte * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update validate string Signed-off-by: Yue, Wenjiao * Update test_searchqna_on_gaudi.sh --------- Signed-off-by: Yue, Wenjiao Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sihan Chen <39623753+Spycsh@users.noreply.github.com> --- SearchQnA/deprecated/ui/svelte/.env | 1 - .../ui/docker/Dockerfile | 0 .../ui/svelte/.editorconfig | 0 SearchQnA/docker/ui/svelte/.env | 1 + .../ui/svelte/.eslintignore | 0 .../ui/svelte/.eslintrc.cjs | 0 .../ui/svelte/.prettierignore | 0 .../ui/svelte/.prettierrc | 0 .../ui/svelte/README.md | 0 .../ui/svelte/package.json | 0 .../ui/svelte/postcss.config.cjs | 0 .../ui/svelte/src/app.d.ts | 0 .../ui/svelte/src/app.html | 0 .../ui/svelte/src/app.postcss | 0 .../lib/assets/avatar/svelte/Delete.svelte | 0 .../lib/assets/chat/svelte/Assistant.svelte | 0 .../assets/chat/svelte/PaperAirplane.svelte | 0 .../assets/chat/svelte/PersonOutlined.svelte | 0 .../src/lib/assets/header/intelLogo.svelte | 0 .../src/lib/assets/layout/css/driver.css | 0 .../svelte/src/lib/assets/upload/next.svelte | 0 .../src/lib/assets/upload/previous.svelte | 0 .../svelte/src/lib/assets/voice/svg/paste.svg | 0 .../src/lib/assets/voice/svg/uploadFile.svg | 0 .../src/lib/modules/chat/ChatMessage.svelte | 0 .../src/lib/modules/chat/MessageAvatar.svelte | 0 .../src/lib/modules/chat/MessageTimer.svelte | 0 .../src/lib/modules/frame/Layout.svelte | 0 .../ui/svelte/src/lib/network/chat/Network.ts | 6 +- .../svelte/src/lib/network/upload/Network.ts | 0 .../ui/svelte/src/lib/shared/Utils.ts | 0 .../shared/components/header/header.svelte | 0 .../shared/components/loading/Loading.svelte | 0 .../components/scrollbar/Scrollbar.svelte | 0 .../src/lib/shared/constant/Interface.ts | 0 .../src/lib/shared/stores/common/Store.ts | 0 .../ui/svelte/src/routes/+layout.svelte | 0 .../ui/svelte/src/routes/+page.svelte | 82 +++++++++++------- .../ui/svelte/src/routes/+page.ts | 0 .../ui/svelte/static/favicon.png | Bin .../ui/svelte/svelte.config.js | 0 .../ui/svelte/tailwind.config.cjs | 0 .../ui/svelte/tsconfig.json | 0 .../ui/svelte/vite.config.ts | 0 SearchQnA/tests/test_searchqna_on_gaudi.sh | 4 +- SearchQnA/tests/test_searchqna_on_xeon.sh | 2 +- 46 files changed, 57 insertions(+), 39 deletions(-) delete mode 100644 SearchQnA/deprecated/ui/svelte/.env rename SearchQnA/{deprecated => docker}/ui/docker/Dockerfile (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/.editorconfig (100%) create mode 100644 SearchQnA/docker/ui/svelte/.env rename SearchQnA/{deprecated => docker}/ui/svelte/.eslintignore (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/.eslintrc.cjs (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/.prettierignore (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/.prettierrc (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/README.md (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/package.json (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/postcss.config.cjs (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/app.d.ts (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/app.html (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/app.postcss (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/assets/avatar/svelte/Delete.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/assets/chat/svelte/Assistant.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/assets/chat/svelte/PaperAirplane.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/assets/chat/svelte/PersonOutlined.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/assets/header/intelLogo.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/assets/layout/css/driver.css (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/assets/upload/next.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/assets/upload/previous.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/assets/voice/svg/paste.svg (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/assets/voice/svg/uploadFile.svg (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/modules/chat/ChatMessage.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/modules/chat/MessageAvatar.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/modules/chat/MessageTimer.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/modules/frame/Layout.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/network/chat/Network.ts (90%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/network/upload/Network.ts (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/shared/Utils.ts (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/shared/components/header/header.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/shared/components/loading/Loading.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/shared/components/scrollbar/Scrollbar.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/shared/constant/Interface.ts (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/lib/shared/stores/common/Store.ts (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/routes/+layout.svelte (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/routes/+page.svelte (83%) rename SearchQnA/{deprecated => docker}/ui/svelte/src/routes/+page.ts (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/static/favicon.png (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/svelte.config.js (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/tailwind.config.cjs (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/tsconfig.json (100%) rename SearchQnA/{deprecated => docker}/ui/svelte/vite.config.ts (100%) diff --git a/SearchQnA/deprecated/ui/svelte/.env b/SearchQnA/deprecated/ui/svelte/.env deleted file mode 100644 index 4f519d803..000000000 --- a/SearchQnA/deprecated/ui/svelte/.env +++ /dev/null @@ -1 +0,0 @@ -BACKEND_BASE_URL = 'http://xxxxx:8085/v1/rag' \ No newline at end of file diff --git a/SearchQnA/deprecated/ui/docker/Dockerfile b/SearchQnA/docker/ui/docker/Dockerfile similarity index 100% rename from SearchQnA/deprecated/ui/docker/Dockerfile rename to SearchQnA/docker/ui/docker/Dockerfile diff --git a/SearchQnA/deprecated/ui/svelte/.editorconfig b/SearchQnA/docker/ui/svelte/.editorconfig similarity index 100% rename from SearchQnA/deprecated/ui/svelte/.editorconfig rename to SearchQnA/docker/ui/svelte/.editorconfig diff --git a/SearchQnA/docker/ui/svelte/.env b/SearchQnA/docker/ui/svelte/.env new file mode 100644 index 000000000..a3c0eb228 --- /dev/null +++ b/SearchQnA/docker/ui/svelte/.env @@ -0,0 +1 @@ +BACKEND_BASE_URL = 'http://x.x.x.x:yyyy/v1/searchqna' \ No newline at end of file diff --git a/SearchQnA/deprecated/ui/svelte/.eslintignore b/SearchQnA/docker/ui/svelte/.eslintignore similarity index 100% rename from SearchQnA/deprecated/ui/svelte/.eslintignore rename to SearchQnA/docker/ui/svelte/.eslintignore diff --git a/SearchQnA/deprecated/ui/svelte/.eslintrc.cjs b/SearchQnA/docker/ui/svelte/.eslintrc.cjs similarity index 100% rename from SearchQnA/deprecated/ui/svelte/.eslintrc.cjs rename to SearchQnA/docker/ui/svelte/.eslintrc.cjs diff --git a/SearchQnA/deprecated/ui/svelte/.prettierignore b/SearchQnA/docker/ui/svelte/.prettierignore similarity index 100% rename from SearchQnA/deprecated/ui/svelte/.prettierignore rename to SearchQnA/docker/ui/svelte/.prettierignore diff --git a/SearchQnA/deprecated/ui/svelte/.prettierrc b/SearchQnA/docker/ui/svelte/.prettierrc similarity index 100% rename from SearchQnA/deprecated/ui/svelte/.prettierrc rename to SearchQnA/docker/ui/svelte/.prettierrc diff --git a/SearchQnA/deprecated/ui/svelte/README.md b/SearchQnA/docker/ui/svelte/README.md similarity index 100% rename from SearchQnA/deprecated/ui/svelte/README.md rename to SearchQnA/docker/ui/svelte/README.md diff --git a/SearchQnA/deprecated/ui/svelte/package.json b/SearchQnA/docker/ui/svelte/package.json similarity index 100% rename from SearchQnA/deprecated/ui/svelte/package.json rename to SearchQnA/docker/ui/svelte/package.json diff --git a/SearchQnA/deprecated/ui/svelte/postcss.config.cjs b/SearchQnA/docker/ui/svelte/postcss.config.cjs similarity index 100% rename from SearchQnA/deprecated/ui/svelte/postcss.config.cjs rename to SearchQnA/docker/ui/svelte/postcss.config.cjs diff --git a/SearchQnA/deprecated/ui/svelte/src/app.d.ts b/SearchQnA/docker/ui/svelte/src/app.d.ts similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/app.d.ts rename to SearchQnA/docker/ui/svelte/src/app.d.ts diff --git a/SearchQnA/deprecated/ui/svelte/src/app.html b/SearchQnA/docker/ui/svelte/src/app.html similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/app.html rename to SearchQnA/docker/ui/svelte/src/app.html diff --git a/SearchQnA/deprecated/ui/svelte/src/app.postcss b/SearchQnA/docker/ui/svelte/src/app.postcss similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/app.postcss rename to SearchQnA/docker/ui/svelte/src/app.postcss diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/assets/avatar/svelte/Delete.svelte b/SearchQnA/docker/ui/svelte/src/lib/assets/avatar/svelte/Delete.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/assets/avatar/svelte/Delete.svelte rename to SearchQnA/docker/ui/svelte/src/lib/assets/avatar/svelte/Delete.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/assets/chat/svelte/Assistant.svelte b/SearchQnA/docker/ui/svelte/src/lib/assets/chat/svelte/Assistant.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/assets/chat/svelte/Assistant.svelte rename to SearchQnA/docker/ui/svelte/src/lib/assets/chat/svelte/Assistant.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/assets/chat/svelte/PaperAirplane.svelte b/SearchQnA/docker/ui/svelte/src/lib/assets/chat/svelte/PaperAirplane.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/assets/chat/svelte/PaperAirplane.svelte rename to SearchQnA/docker/ui/svelte/src/lib/assets/chat/svelte/PaperAirplane.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/assets/chat/svelte/PersonOutlined.svelte b/SearchQnA/docker/ui/svelte/src/lib/assets/chat/svelte/PersonOutlined.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/assets/chat/svelte/PersonOutlined.svelte rename to SearchQnA/docker/ui/svelte/src/lib/assets/chat/svelte/PersonOutlined.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/assets/header/intelLogo.svelte b/SearchQnA/docker/ui/svelte/src/lib/assets/header/intelLogo.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/assets/header/intelLogo.svelte rename to SearchQnA/docker/ui/svelte/src/lib/assets/header/intelLogo.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/assets/layout/css/driver.css b/SearchQnA/docker/ui/svelte/src/lib/assets/layout/css/driver.css similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/assets/layout/css/driver.css rename to SearchQnA/docker/ui/svelte/src/lib/assets/layout/css/driver.css diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/assets/upload/next.svelte b/SearchQnA/docker/ui/svelte/src/lib/assets/upload/next.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/assets/upload/next.svelte rename to SearchQnA/docker/ui/svelte/src/lib/assets/upload/next.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/assets/upload/previous.svelte b/SearchQnA/docker/ui/svelte/src/lib/assets/upload/previous.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/assets/upload/previous.svelte rename to SearchQnA/docker/ui/svelte/src/lib/assets/upload/previous.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/assets/voice/svg/paste.svg b/SearchQnA/docker/ui/svelte/src/lib/assets/voice/svg/paste.svg similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/assets/voice/svg/paste.svg rename to SearchQnA/docker/ui/svelte/src/lib/assets/voice/svg/paste.svg diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/assets/voice/svg/uploadFile.svg b/SearchQnA/docker/ui/svelte/src/lib/assets/voice/svg/uploadFile.svg similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/assets/voice/svg/uploadFile.svg rename to SearchQnA/docker/ui/svelte/src/lib/assets/voice/svg/uploadFile.svg diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/modules/chat/ChatMessage.svelte b/SearchQnA/docker/ui/svelte/src/lib/modules/chat/ChatMessage.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/modules/chat/ChatMessage.svelte rename to SearchQnA/docker/ui/svelte/src/lib/modules/chat/ChatMessage.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/modules/chat/MessageAvatar.svelte b/SearchQnA/docker/ui/svelte/src/lib/modules/chat/MessageAvatar.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/modules/chat/MessageAvatar.svelte rename to SearchQnA/docker/ui/svelte/src/lib/modules/chat/MessageAvatar.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/modules/chat/MessageTimer.svelte b/SearchQnA/docker/ui/svelte/src/lib/modules/chat/MessageTimer.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/modules/chat/MessageTimer.svelte rename to SearchQnA/docker/ui/svelte/src/lib/modules/chat/MessageTimer.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/modules/frame/Layout.svelte b/SearchQnA/docker/ui/svelte/src/lib/modules/frame/Layout.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/modules/frame/Layout.svelte rename to SearchQnA/docker/ui/svelte/src/lib/modules/frame/Layout.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/network/chat/Network.ts b/SearchQnA/docker/ui/svelte/src/lib/network/chat/Network.ts similarity index 90% rename from SearchQnA/deprecated/ui/svelte/src/lib/network/chat/Network.ts rename to SearchQnA/docker/ui/svelte/src/lib/network/chat/Network.ts index d72197379..2381054c6 100644 --- a/SearchQnA/deprecated/ui/svelte/src/lib/network/chat/Network.ts +++ b/SearchQnA/docker/ui/svelte/src/lib/network/chat/Network.ts @@ -22,10 +22,10 @@ export async function fetchTextStream(query: string, knowledge_base_id: string, let url = ""; payload = { - query: query, - knowledge_base_id: knowledge_base_id, + messages: query, + stream: "True", }; - url = `${BACKEND_BASE_URL}/web_search_chat_stream`; + url = `${BACKEND_BASE_URL}`; return new SSE(url, { headers: { "Content-Type": "application/json" }, diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/network/upload/Network.ts b/SearchQnA/docker/ui/svelte/src/lib/network/upload/Network.ts similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/network/upload/Network.ts rename to SearchQnA/docker/ui/svelte/src/lib/network/upload/Network.ts diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/shared/Utils.ts b/SearchQnA/docker/ui/svelte/src/lib/shared/Utils.ts similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/shared/Utils.ts rename to SearchQnA/docker/ui/svelte/src/lib/shared/Utils.ts diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/shared/components/header/header.svelte b/SearchQnA/docker/ui/svelte/src/lib/shared/components/header/header.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/shared/components/header/header.svelte rename to SearchQnA/docker/ui/svelte/src/lib/shared/components/header/header.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/shared/components/loading/Loading.svelte b/SearchQnA/docker/ui/svelte/src/lib/shared/components/loading/Loading.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/shared/components/loading/Loading.svelte rename to SearchQnA/docker/ui/svelte/src/lib/shared/components/loading/Loading.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/shared/components/scrollbar/Scrollbar.svelte b/SearchQnA/docker/ui/svelte/src/lib/shared/components/scrollbar/Scrollbar.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/shared/components/scrollbar/Scrollbar.svelte rename to SearchQnA/docker/ui/svelte/src/lib/shared/components/scrollbar/Scrollbar.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/shared/constant/Interface.ts b/SearchQnA/docker/ui/svelte/src/lib/shared/constant/Interface.ts similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/shared/constant/Interface.ts rename to SearchQnA/docker/ui/svelte/src/lib/shared/constant/Interface.ts diff --git a/SearchQnA/deprecated/ui/svelte/src/lib/shared/stores/common/Store.ts b/SearchQnA/docker/ui/svelte/src/lib/shared/stores/common/Store.ts similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/lib/shared/stores/common/Store.ts rename to SearchQnA/docker/ui/svelte/src/lib/shared/stores/common/Store.ts diff --git a/SearchQnA/deprecated/ui/svelte/src/routes/+layout.svelte b/SearchQnA/docker/ui/svelte/src/routes/+layout.svelte similarity index 100% rename from SearchQnA/deprecated/ui/svelte/src/routes/+layout.svelte rename to SearchQnA/docker/ui/svelte/src/routes/+layout.svelte diff --git a/SearchQnA/deprecated/ui/svelte/src/routes/+page.svelte b/SearchQnA/docker/ui/svelte/src/routes/+page.svelte similarity index 83% rename from SearchQnA/deprecated/ui/svelte/src/routes/+page.svelte rename to SearchQnA/docker/ui/svelte/src/routes/+page.svelte index 4e7c57984..a7aa82d44 100644 --- a/SearchQnA/deprecated/ui/svelte/src/routes/+page.svelte +++ b/SearchQnA/docker/ui/svelte/src/routes/+page.svelte @@ -16,7 +16,11 @@
@@ -165,7 +183,7 @@ class="fixed relative flex w-full flex-col items-center justify-between bg-white p-2 pb-0" >
-
+
tgi_service_start.log if grep -q Connected tgi_service_start.log; then break @@ -84,7 +84,7 @@ function validate_megaservice() { result=$(http_proxy="" curl http://${ip_address}:3008/v1/searchqna -XPOST -d '{"messages": "What is the latest news? Give me also the source link", "stream": "False"}' -H 'Content-Type: application/json') echo $result - if [[ $result == *"www"* ]]; then + if [[ $result == *"news"* ]]; then echo "Result correct." else docker logs web-retriever-chroma-server diff --git a/SearchQnA/tests/test_searchqna_on_xeon.sh b/SearchQnA/tests/test_searchqna_on_xeon.sh index 893a93497..634ad86c6 100644 --- a/SearchQnA/tests/test_searchqna_on_xeon.sh +++ b/SearchQnA/tests/test_searchqna_on_xeon.sh @@ -78,7 +78,7 @@ function validate_megaservice() { result=$(http_proxy="" curl http://${ip_address}:3008/v1/searchqna -XPOST -d '{"messages": "What is the latest news? Give me also the source link", "stream": "False"}' -H 'Content-Type: application/json') echo $result - if [[ $result == *"www"* ]]; then + if [[ $result == *"news"* ]]; then echo "Result correct." else docker logs web-retriever-chroma-server