Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
30c24a0
Added React Based UI for ChatQnA
jaswanth8888 Jun 21, 2024
03e416f
Added README Changes
yogeshmpandey Jun 24, 2024
d8bb1e9
Merge pull request #1 from yogeshmpandey/yogesh/README
jaswanth8888 Jun 24, 2024
8441b43
Merge branch 'main' of https://github.com/jaswanth8888/GenAIExamples …
jaswanth8888 Jun 24, 2024
5403e9a
Merge pull request #2 from jaswanth8888/chatqna-react
jaswanth8888 Jun 24, 2024
1af2963
Changes to address review comments and Typo Fixes
yogeshmpandey Jun 24, 2024
c1db15b
Changes to README and Typo Fixes
yogeshmpandey Jun 24, 2024
8597d29
Merge pull request #3 from yogeshmpandey/yogeshpa/changes
jaswanth8888 Jun 24, 2024
4fd5431
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 24, 2024
96cc896
added license to all files
jaswanth8888 Jun 24, 2024
a9e2a71
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 24, 2024
a114e2b
Removed comments from tsconfig
jaswanth8888 Jun 24, 2024
8fdbc3f
Merge branch 'main' of https://github.com/jaswanth8888/GenAIExamples …
jaswanth8888 Jun 24, 2024
ac41a49
fixed typo
jaswanth8888 Jun 24, 2024
9417e91
updated image name in readme
jaswanth8888 Jun 24, 2024
a544f85
added vitest
jaswanth8888 Jun 24, 2024
131bade
added vitest
jaswanth8888 Jun 24, 2024
e3a5998
Merge pull request #4 from jaswanth8888/react-tests
jaswanth8888 Jun 24, 2024
2df99ad
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 24, 2024
39bad5d
Merge branch 'main' into main
jaswanth8888 Jun 24, 2024
f2c0499
Merge branch 'main' into main
jaswanth8888 Jun 25, 2024
4d5e72e
added workflow changes
jaswanth8888 Jun 25, 2024
138d5ef
Merge branch 'main' into main
jaswanth8888 Jun 25, 2024
4c6c866
update img location (#282)
Spycsh Jun 14, 2024
deb4b43
Check the Dockerfile path (#292)
ZePan110 Jun 14, 2024
3760c81
enable building latest megaservice image on push event in CI (#288)
daisy-ycguo Jun 17, 2024
614098f
Fix missing Dockerfiles path in GenAIComps (#303)
daisy-ycguo Jun 18, 2024
848a7fe
Add image build job in docker compose e2e xeon test in CI (#304)
daisy-ycguo Jun 19, 2024
0ee06f0
fix the image build refer (#309)
chensuyue Jun 20, 2024
dec2617
Add image build job in docker compose e2e gaudi test in CI (#305)
daisy-ycguo Jun 21, 2024
bdae950
Add gpu support for ChatQnA (#308)
kding1 Jun 21, 2024
af35137
Added React Based UI for ChatQnA
jaswanth8888 Jun 21, 2024
b735c57
Added README Changes
yogeshmpandey Jun 24, 2024
dee454c
Changes to address review comments and Typo Fixes
yogeshmpandey Jun 24, 2024
b73cc88
Changes to README and Typo Fixes
yogeshmpandey Jun 24, 2024
6644dfe
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 24, 2024
73ab94b
added license to all files
jaswanth8888 Jun 24, 2024
cd90343
Removed comments from tsconfig
jaswanth8888 Jun 24, 2024
7bbd58c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 24, 2024
adea4f2
fixed typo
jaswanth8888 Jun 24, 2024
fdc8c3a
updated image name in readme
jaswanth8888 Jun 24, 2024
7f9c2f1
added vitest
jaswanth8888 Jun 24, 2024
186619f
added vitest
jaswanth8888 Jun 24, 2024
68bf25c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 24, 2024
6a8759c
Update ChatQnA for Xeon docker_compose.yaml to fix downloads failing …
wsfowler Jun 24, 2024
1b7d7bb
Add build docker image option for test scripts (#312)
chensuyue Jun 24, 2024
e2c4a3d
added workflow changes
jaswanth8888 Jun 25, 2024
023c5bd
Refactor Translation Example (#287)
zehao-intel Jun 25, 2024
c86accd
Merge branch 'main' of https://github.com/jaswanth8888/GenAIExamples …
jaswanth8888 Jun 25, 2024
7841e0f
Merge branch 'main' into main
jaswanth8888 Jun 25, 2024
a33379a
Merge branch 'main' into main
jaswanth8888 Jun 25, 2024
9569e29
Merge branch 'main' of https://github.com/jaswanth8888/GenAIExamples …
jaswanth8888 Jun 25, 2024
341bd50
modified test_chatqna_on_xeon.sh
jaswanth8888 Jun 25, 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
3 changes: 3 additions & 0 deletions .github/workflows/scripts/build_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ for MEGA_SVC in $1; do
docker_build ${IMAGE_NAME}
cd ui
docker_build ${IMAGE_NAME}-ui docker/Dockerfile
if [ "$MEGA_SVC" == "ChatQnA" ];then
docker_build ${IMAGE_NAME}-conversation-ui docker/Dockerfile.react
fi
;;
"AudioQnA"|"SearchQnA"|"VisualQnA")
echo "Not supported yet"
Expand Down
Binary file added ChatQnA/assets/img/conversation_ui_init.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ChatQnA/assets/img/conversation_ui_response.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ChatQnA/assets/img/conversation_ui_upload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions ChatQnA/docker/ui/docker/Dockerfile.react
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node as vite-app

COPY . /usr/app
WORKDIR /usr/app/react

ARG BACKEND_SERVICE_ENDPOINT
ARG DATAPREP_SERVICE_ENDPOINT
ENV VITE_BACKEND_SERVICE_ENDPOINT=$BACKEND_SERVICE_ENDPOINT
ENV VITE_DATA_PREP_SERVICE_URL=$DATAPREP_SERVICE_ENDPOINT

RUN ["npm", "install"]
RUN ["npm", "run", "build"]


FROM nginx:alpine
EXPOSE 80


COPY --from=vite-app /usr/app/react/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=vite-app /usr/app/react/dist /usr/share/nginx/html

ENTRYPOINT ["nginx", "-g", "daemon off;"]
2 changes: 2 additions & 0 deletions ChatQnA/docker/ui/react/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_BACKEND_SERVICE_ENDPOINT=http://backend_address:8888/v1/chatqna
VITE_DATA_PREP_SERVICE_URL=http://backend_address:6007/v1/dataprep
11 changes: 11 additions & 0 deletions ChatQnA/docker/ui/react/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:react-hooks/recommended"],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
},
};
24 changes: 24 additions & 0 deletions ChatQnA/docker/ui/react/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
32 changes: 32 additions & 0 deletions ChatQnA/docker/ui/react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<h1 align="center" id="title"> ChatQnA Conversational UI</h1>

### 📸 Project Screenshots

![project-screenshot](../../../assets/img/conversation_ui_init.png)
![project-screenshot](../../../assets/img/conversation_ui_response.png)
![project-screenshot](../../../assets/img/conversation_ui_upload.png)

<h2>🧐 Features</h2>

Here're some of the project's features:

- Start a Text Chat:Initiate a text chat with the ability to input written conversations, where the dialogue content can also be customized based on uploaded files.
- Context Awareness: The AI assistant maintains the context of the conversation, understanding references to previous statements or questions. This allows for more natural and coherent exchanges.
- Upload File: The choice between uploading locally or copying a remote link. Chat according to uploaded knowledge base.
- Clear: Clear the record of the current dialog box without retaining the contents of the dialog box.
- Chat history: Historical chat records can still be retained after refreshing, making it easier for users to view the context.
- Conversational Chat : The application maintains a history of the conversation, allowing users to review previous messages and the AI to refer back to earlier points in the dialogue when necessary.

<h2>🛠️ Get it Running:</h2>

1. Clone the repo.

2. cd command to the current folder.

3. Modify the required .env variables.
```
DOC_BASE_URL = ''
```
4. Execute `npm install` to install the corresponding dependencies.

5. Execute `npm run dev` in both environments
18 changes: 18 additions & 0 deletions ChatQnA/docker/ui/react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
Copyright (C) 2024 Intel Corporation
SPDX-License-Identifier: Apache-2.0
-->

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/assets/opea-icon-color.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Conversations UI</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions ChatQnA/docker/ui/react/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
server {
listen 80;

gzip on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types font/woff2 text/css application/javascript application/json application/font-woff application/font-tff image/gif image/png image/svg+xml application/octet-stream;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;

location ~* \.(gif|jpe?g|png|webp|ico|svg|css|js|mp4|woff2)$ {
expires 1d;
}
}
}
47 changes: 47 additions & 0 deletions ChatQnA/docker/ui/react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "ui",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"test": "vitest"
},
"dependencies": {
"@mantine/core": "^7.10.0",
"@mantine/hooks": "^7.10.0",
"@mantine/notifications": "^7.10.2",
"@microsoft/fetch-event-source": "^2.0.1",
"@reduxjs/toolkit": "^2.2.5",
"@tabler/icons-react": "^3.5.0",
"axios": "^1.7.2",
"luxon": "^3.4.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^9.1.2"
},
"devDependencies": {
"@testing-library/react": "^16.0.0",
"@types/luxon": "^3.4.2",
"@types/node": "^20.12.12",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"jsdom": "^24.1.0",
"postcss": "^8.4.38",
"postcss-preset-mantine": "^1.15.0",
"postcss-simple-vars": "^7.0.1",
"sass": "1.64.2",
"typescript": "^5.2.2",
"vite": "^5.2.13",
"vitest": "^1.6.0"
}
}
14 changes: 14 additions & 0 deletions ChatQnA/docker/ui/react/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
plugins: {
"postcss-preset-mantine": {},
"postcss-simple-vars": {
variables: {
"mantine-breakpoint-xs": "36em",
"mantine-breakpoint-sm": "48em",
"mantine-breakpoint-md": "62em",
"mantine-breakpoint-lg": "75em",
"mantine-breakpoint-xl": "88em",
},
},
},
};
1 change: 1 addition & 0 deletions ChatQnA/docker/ui/react/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions ChatQnA/docker/ui/react/src/App.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (C) 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

@import "./styles/styles";

.root {
@include flex(row, nowrap, flex-start, flex-start);
}

.layout-wrapper {
@include absolutes;

display: grid;

width: 100%;
height: 100%;

grid-template-columns: 80px auto;
grid-template-rows: 1fr;
}

/* ===== Scrollbar CSS ===== */
/* Firefox */
* {
scrollbar-width: thin;
scrollbar-color: #d6d6d6 #ffffff;
}

/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: 8px;
}

*::-webkit-scrollbar-track {
background: #ffffff;
}

*::-webkit-scrollbar-thumb {
background-color: #d6d6d6;
border-radius: 16px;
border: 4px double #dedede;
}
34 changes: 34 additions & 0 deletions ChatQnA/docker/ui/react/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (C) 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

import "./App.scss"
import { MantineProvider } from "@mantine/core"
import '@mantine/notifications/styles.css';
import { SideNavbar, SidebarNavList } from "./components/sidebar/sidebar"
import { IconMessages } from "@tabler/icons-react"
import UserInfoModal from "./components/UserInfoModal/UserInfoModal"
import Conversation from "./components/Conversation/Conversation"
import { Notifications } from '@mantine/notifications';

const title = "Chat QnA"
const navList: SidebarNavList = [
{ icon: IconMessages, label: title }
]

function App() {

return (
<MantineProvider>
<Notifications position="top-right" />
<UserInfoModal />
<div className="layout-wrapper">
<SideNavbar navList={navList} />
<div className="content">
<Conversation title={title} />
</div>
</div>
</MantineProvider>
)
}

export default App
14 changes: 14 additions & 0 deletions ChatQnA/docker/ui/react/src/__tests__/util.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (C) 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

import { describe, expect, test } from "vitest";
import { getCurrentTimeStamp, uuidv4 } from "../common/util";

describe("unit tests", () => {
test("check UUID is of length 36", () => {
expect(uuidv4()).toHaveLength(36);
});
test("check TimeStamp generated is of unix", () => {
expect(getCurrentTimeStamp()).toBe(Math.floor(Date.now() / 1000));
});
});
39 changes: 39 additions & 0 deletions ChatQnA/docker/ui/react/src/assets/opea-icon-black.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions ChatQnA/docker/ui/react/src/assets/opea-icon-color.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ChatQnA/docker/ui/react/src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading