-
Notifications
You must be signed in to change notification settings - Fork 330
added doc sum react-ui #418
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
Merged
chensuyue
merged 29 commits into
opea-project:main
from
jaswanth8888:feat/docsum-react-ui
Jul 25, 2024
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
1c32ad0
DocSum: Manifest to deploy DocSum with ReactUI into Kubernetes
hteeyeoh 168d1b5
Manifests to deploy DocSum into Kubernetes
hteeyeoh 1e8cbd3
added doc sum react-ui
jaswanth8888 1dcd8f6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] f0b527c
fixed build issue
jaswanth8888 1bba035
Merge branch 'feat/docsum-react-ui' of https://github.com/jaswanth888…
jaswanth8888 abe68d3
Merge branch 'opea-project:main' into htee/docsum_k8s
hteeyeoh 82ae0f7
fixed typo
jaswanth8888 8e73fb9
Merge branch 'main' into feat/docsum-react-ui
jaswanth8888 dfa63d5
Merge pull request #2 from hteeyeoh/htee/docsum_k8s
jaswanth8888 d1bd721
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 9b9a85c
Updated readme files
jaswanth8888 fe9bfc3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 42d1432
updated readme
jaswanth8888 1e3d0f3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] fed7126
Merge branch 'main' into feat/docsum-react-ui
jaswanth8888 ee92e0c
Updated base image for react
jaswanth8888 f1cbc88
updated base image
jaswanth8888 b4b1d3f
updated readme
jaswanth8888 4df8266
made changes as per review comments
jaswanth8888 5eb0cab
Merge branch 'main' into feat/docsum-react-ui
hteeyeoh 5579cd9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] cf3cbf2
Merge branch 'main' into feat/docsum-react-ui
jaswanth8888 3258349
fixed pr suggestions
jaswanth8888 0d8a870
Merge branch 'main' into feat/docsum-react-ui
jaswanth8888 fad00e0
updated sleep time as service takes time to come up
jaswanth8888 4a07a12
updated test files
jaswanth8888 bd3acff
Merge branch 'main' into feat/docsum-react-ui
jaswanth8888 8720d34
fixed typo
jaswanth8888 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Copyright (C) 2024 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Use node 20.11.1 as the base image | ||
| FROM node:20.11.1 as vite-app | ||
|
|
||
| COPY . /usr/app | ||
| WORKDIR /usr/app/react | ||
|
|
||
| ARG BACKEND_SERVICE_ENDPOINT | ||
| ENV VITE_DOC_SUM_URL=$BACKEND_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;"] |
jaswanth8888 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| VITE_DOC_SUM_URL=http://backend_address:8888/v1/docsum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }], | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <h1 align="center" id="title">Doc Summary React</h1> | ||
|
|
||
| ### 📸 Project Screenshots | ||
|
|
||
|  | ||
|  | ||
|  | ||
|
|
||
| <h2>🧐 Features</h2> | ||
|
|
||
| Here're some of the project's features: | ||
|
|
||
| - Summarizing Uploaded Files: Upload files from their local device, then click 'Generate Summary' to summarize the content of the uploaded file. The summary will be displayed on the 'Summary' box. | ||
| - Summarizing Text via Pasting: Paste the text to be summarized into the text box, then click 'Generate Summary' to produce a condensed summary of the content, which will be displayed in the 'Summary' box on the right. | ||
| - Scroll to Bottom: The summarized content will automatically scroll to the bottom. | ||
|
|
||
| <h2>🛠️ Get it Running:</h2> | ||
|
|
||
| 1. Clone the repo. | ||
|
|
||
| 2. cd command to the current folder. | ||
|
|
||
| 3. Modify the required .env variables. | ||
| ``` | ||
| VITE_DOC_SUM_URL = '' | ||
jaswanth8888 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
| 4. Execute `npm install` to install the corresponding dependencies. | ||
|
|
||
| 5. Execute `npm run dev` in both environments | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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>Opea Doc Sum</title> | ||
| </head> | ||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.tsx"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| { | ||
| "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.11.1", | ||
| "@mantine/dropzone": "^7.11.1", | ||
| "@mantine/hooks": "^7.11.1", | ||
| "@mantine/notifications": "^7.11.1", | ||
| "@microsoft/fetch-event-source": "^2.0.1", | ||
| "@reduxjs/toolkit": "^2.2.5", | ||
| "@tabler/icons-react": "^3.9.0", | ||
| "axios": "^1.7.2", | ||
| "luxon": "^3.4.4", | ||
| "react": "^18.2.0", | ||
| "react-dom": "^18.2.0", | ||
| "react-markdown": "^9.0.1", | ||
| "react-syntax-highlighter": "^15.5.0", | ||
| "remark-frontmatter": "^5.0.0", | ||
| "remark-gfm": "^4.0.0" | ||
| }, | ||
| "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", | ||
| "@types/react-syntax-highlighter": "^15.5.13", | ||
| "@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" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", | ||
| }, | ||
| }, | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // 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 { IconFileText } from "@tabler/icons-react" | ||
| import { Notifications } from '@mantine/notifications'; | ||
| import DocSum from "./components/DocSum/DocSum"; | ||
|
|
||
| const title = "Doc Summary" | ||
| const navList: SidebarNavList = [ | ||
| { icon: IconFileText, label: title } | ||
| ] | ||
|
|
||
| function App() { | ||
|
|
||
| return ( | ||
| <MantineProvider> | ||
| <Notifications position="top-right" /> | ||
| <div className="layout-wrapper"> | ||
| <SideNavbar navList={navList} /> | ||
| <div className="content"> | ||
| <DocSum /> | ||
| </div> | ||
| </div> | ||
| </MantineProvider> | ||
| ) | ||
| } | ||
|
|
||
| export default App |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.