diff --git a/.github/workflows/_example-workflow.yml b/.github/workflows/_example-workflow.yml index 6081ed9b1d..f66a2a323d 100644 --- a/.github/workflows/_example-workflow.yml +++ b/.github/workflows/_example-workflow.yml @@ -79,6 +79,7 @@ jobs: fi if [[ $(grep -c "vllm-gaudi:" ${docker_compose_path}) != 0 ]]; then git clone https://github.com/HabanaAI/vllm-fork.git + cd vllm-fork && git checkout v0.6.4.post2+Gaudi-1.19.0 && cd ../ fi git clone https://github.com/opea-project/GenAIComps.git cd GenAIComps && git checkout ${{ inputs.opea_branch }} && git rev-parse HEAD && cd ../ diff --git a/AgentQnA/README.md b/AgentQnA/README.md index 548e643f5d..d45b14ef55 100644 --- a/AgentQnA/README.md +++ b/AgentQnA/README.md @@ -3,7 +3,7 @@ ## Overview This example showcases a hierarchical multi-agent system for question-answering applications. The architecture diagram is shown below. The supervisor agent interfaces with the user and dispatch tasks to two worker agents to gather information and come up with answers. The worker RAG agent uses the retrieval tool to retrieve relevant documents from the knowledge base (a vector database). The worker SQL agent retrieve relevant data from the SQL database. Although not included in this example, but other tools such as a web search tool or a knowledge graph query tool can be used by the supervisor agent to gather information from additional sources. -![Architecture Overview](assets/agent_qna_arch.png) +![Architecture Overview](assets/img/agent_qna_arch.png) The AgentQnA example is implemented using the component-level microservices defined in [GenAIComps](https://github.com/opea-project/GenAIComps). The flow chart below shows the information flow between different microservices for this example. @@ -264,6 +264,12 @@ curl http://${host_ip}:9090/v1/chat/completions -X POST -H "Content-Type: applic }' ``` +## Deploy AgentQnA UI + +The AgentQnA UI can be deployed locally or using Docker. + +For detailed instructions on deploying AgentQnA UI, refer to the [AgentQnA UI Guide](./ui/svelte/README.md). + ## How to register your own tools with agent You can take a look at the tools yaml and python files in this example. For more details, please refer to the "Provide your own tools" section in the instructions [here](https://github.com/opea-project/GenAIComps/tree/main/comps/agent/src/README.md). diff --git a/AgentQnA/assets/agent_qna_arch.png b/AgentQnA/assets/img/agent_qna_arch.png similarity index 100% rename from AgentQnA/assets/agent_qna_arch.png rename to AgentQnA/assets/img/agent_qna_arch.png diff --git a/AgentQnA/assets/img/agent_ui.png b/AgentQnA/assets/img/agent_ui.png new file mode 100644 index 0000000000..154c85be83 Binary files /dev/null and b/AgentQnA/assets/img/agent_ui.png differ diff --git a/AgentQnA/assets/img/agent_ui_result.png b/AgentQnA/assets/img/agent_ui_result.png new file mode 100644 index 0000000000..813248d6a3 Binary files /dev/null and b/AgentQnA/assets/img/agent_ui_result.png differ diff --git a/AgentQnA/docker_image_build/build.yaml b/AgentQnA/docker_image_build/build.yaml index 61f2b0dda5..723a61c873 100644 --- a/AgentQnA/docker_image_build/build.yaml +++ b/AgentQnA/docker_image_build/build.yaml @@ -11,3 +11,9 @@ services: https_proxy: ${https_proxy} no_proxy: ${no_proxy} image: ${REGISTRY:-opea}/agent:${TAG:-latest} + agent-ui: + build: + context: ../ui + dockerfile: ./docker/Dockerfile + extends: agent + image: ${REGISTRY:-opea}/agent-ui:${TAG:-latest} diff --git a/AgentQnA/tests/step1_build_images.sh b/AgentQnA/tests/step1_build_images.sh index 2631156144..4782da677a 100644 --- a/AgentQnA/tests/step1_build_images.sh +++ b/AgentQnA/tests/step1_build_images.sh @@ -21,7 +21,7 @@ function build_docker_images_for_retrieval_tool(){ # git clone https://github.com/opea-project/GenAIComps.git && cd GenAIComps && git checkout "${opea_branch:-"main"}" && cd ../ get_genai_comps echo "Build all the images with --no-cache..." - service_list="doc-index-retriever dataprep-redis embedding retriever-redis reranking" + service_list="doc-index-retriever dataprep-redis embedding retriever reranking" docker compose -f build.yaml build ${service_list} --no-cache docker pull ghcr.io/huggingface/text-embeddings-inference:cpu-1.5 diff --git a/AgentQnA/ui/docker/Dockerfile b/AgentQnA/ui/docker/Dockerfile new file mode 100644 index 0000000000..1d5115f4b5 --- /dev/null +++ b/AgentQnA/ui/docker/Dockerfile @@ -0,0 +1,26 @@ +# 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 + +# Update package manager and install Git +RUN apt-get update -y && apt-get install -y git + +# Copy the front-end code repository +COPY svelte /home/user/svelte + +# Set the working directory +WORKDIR /home/user/svelte + +# Install front-end dependencies +RUN npm install + +# Build the front-end application +RUN npm run build + +# Expose the port of the front-end application +EXPOSE 5173 + +# Run the front-end application in preview mode +CMD ["npm", "run", "preview", "--", "--port", "5173", "--host", "0.0.0.0"] diff --git a/AgentQnA/ui/svelte/.editorconfig b/AgentQnA/ui/svelte/.editorconfig new file mode 100644 index 0000000000..2b7a6637f7 --- /dev/null +++ b/AgentQnA/ui/svelte/.editorconfig @@ -0,0 +1,10 @@ +[*] +indent_style = tab + +[package.json] +indent_style = space +indent_size = 2 + +[*.md] +indent_style = space +indent_size = 2 diff --git a/AgentQnA/ui/svelte/.env b/AgentQnA/ui/svelte/.env new file mode 100644 index 0000000000..260701a6d0 --- /dev/null +++ b/AgentQnA/ui/svelte/.env @@ -0,0 +1 @@ +AGENT_URL = '/v1/chat/completions' diff --git a/AgentQnA/ui/svelte/.eslintignore b/AgentQnA/ui/svelte/.eslintignore new file mode 100644 index 0000000000..38972655fa --- /dev/null +++ b/AgentQnA/ui/svelte/.eslintignore @@ -0,0 +1,13 @@ +.DS_Store +node_modules +/build +/.svelte-kit +/package +.env +.env.* +!.env.example + +# Ignore files for PNPM, NPM and YARN +pnpm-lock.yaml +package-lock.json +yarn.lock diff --git a/AgentQnA/ui/svelte/.eslintrc.cjs b/AgentQnA/ui/svelte/.eslintrc.cjs new file mode 100644 index 0000000000..cfe2be4d4d --- /dev/null +++ b/AgentQnA/ui/svelte/.eslintrc.cjs @@ -0,0 +1,20 @@ +module.exports = { + root: true, + parser: "@typescript-eslint/parser", + extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"], + plugins: ["svelte3", "@typescript-eslint", "neverthrow"], + ignorePatterns: ["*.cjs"], + overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }], + settings: { + "svelte3/typescript": () => require("typescript"), + }, + parserOptions: { + sourceType: "module", + ecmaVersion: 2020, + }, + env: { + browser: true, + es2017: true, + node: true, + }, +}; diff --git a/AgentQnA/ui/svelte/.prettierignore b/AgentQnA/ui/svelte/.prettierignore new file mode 100644 index 0000000000..38972655fa --- /dev/null +++ b/AgentQnA/ui/svelte/.prettierignore @@ -0,0 +1,13 @@ +.DS_Store +node_modules +/build +/.svelte-kit +/package +.env +.env.* +!.env.example + +# Ignore files for PNPM, NPM and YARN +pnpm-lock.yaml +package-lock.json +yarn.lock diff --git a/AgentQnA/ui/svelte/.prettierrc b/AgentQnA/ui/svelte/.prettierrc new file mode 100644 index 0000000000..3b2006102e --- /dev/null +++ b/AgentQnA/ui/svelte/.prettierrc @@ -0,0 +1,13 @@ +{ + "pluginSearchDirs": [ + "." + ], + "overrides": [ + { + "files": "*.svelte", + "options": { + "parser": "svelte" + } + } + ] +} \ No newline at end of file diff --git a/AgentQnA/ui/svelte/README.md b/AgentQnA/ui/svelte/README.md new file mode 100644 index 0000000000..bd0ae2da10 --- /dev/null +++ b/AgentQnA/ui/svelte/README.md @@ -0,0 +1,60 @@ +# AgentQnA + +## 📸 Project Screenshots + +![project-screenshot](../../assets/img/agent_ui.png) +![project-screenshot](../../assets/img/agent_ui_result.png) + +## 🧐 Features + +Here're some of the project's features: + +- Create Agent:Provide more precise answers based on user queries, showcase the high-quality output process of complex queries across different dimensions, and consolidate information to present comprehensive answers. + +## 🛠️ Get it Running + +1. Clone the repo. + +2. cd command to the current folder. + + ``` + cd AgentQnA/ui + ``` + +3. Modify the required .env variables. + + ``` + AGENT_URL = '' + ``` + +4. **For Local Development:** + +- Install the dependencies: + + ``` + npm install + ``` + +- Start the development server: + + ``` + npm run dev + ``` + +- The application will be available at `http://localhost:3000`. + +5. **For Docker Setup:** + +- Build the Docker image: + + ``` + docker build -t opea:agent-ui . + ``` + +- Run the Docker container: + + ``` + docker run -d -p 3000:3000 --name agent-ui opea:agent-ui + ``` + +- The application will be available at `http://localhost:3000`. diff --git a/AgentQnA/ui/svelte/package.json b/AgentQnA/ui/svelte/package.json new file mode 100644 index 0000000000..b778040bec --- /dev/null +++ b/AgentQnA/ui/svelte/package.json @@ -0,0 +1,60 @@ +{ + "name": "agent-example", + "version": "0.0.1", + "private": true, + "scripts": { + "dev": "vite dev --host 0.0.0.0", + "build": "vite build", + "preview": "vite preview", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "lint": "prettier --check . && eslint .", + "format": "prettier --write ." + }, + "devDependencies": { + "@fortawesome/free-solid-svg-icons": "6.2.0", + "@sveltejs/adapter-auto": "1.0.0-next.75", + "@sveltejs/kit": "^1.20.1", + "@tailwindcss/typography": "0.5.7", + "@types/debug": "4.1.7", + "@typescript-eslint/eslint-plugin": "^5.27.0", + "@typescript-eslint/parser": "^5.27.0", + "autoprefixer": "^10.4.7", + "daisyui": "^2.52.0", + "debug": "4.3.4", + "eslint": "^8.16.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-neverthrow": "1.1.4", + "eslint-plugin-svelte3": "^4.0.0", + "neverthrow": "5.0.0", + "pocketbase": "0.7.0", + "postcss": "^8.4.23", + "postcss-load-config": "^4.0.1", + "postcss-preset-env": "^8.3.2", + "prettier": "^2.8.8", + "prettier-plugin-svelte": "^2.7.0", + "prettier-plugin-tailwindcss": "^0.3.0", + "svelte": "^3.59.1", + "svelte-check": "^2.7.1", + "svelte-fa": "3.0.3", + "svelte-preprocess": "^4.10.7", + "tailwindcss": "^3.1.5", + "ts-pattern": "4.0.5", + "tslib": "^2.3.1", + "typescript": "^4.7.4", + "vite": "^4.3.9" + }, + "type": "module", + "dependencies": { + "@heroicons/vue": "^2.1.5", + "echarts": "^5.4.2", + "flowbite-svelte": "^0.38.5", + "flowbite-svelte-icons": "^0.3.6", + "fuse.js": "^6.6.2", + "marked": "^15.0.0", + "ramda": "^0.29.0", + "sjcl": "^1.0.8", + "sse.js": "^0.6.1", + "svelte-notifications": "^0.9.98" + } +} diff --git a/AgentQnA/ui/svelte/postcss.config.cjs b/AgentQnA/ui/svelte/postcss.config.cjs new file mode 100644 index 0000000000..e68d4de268 --- /dev/null +++ b/AgentQnA/ui/svelte/postcss.config.cjs @@ -0,0 +1,13 @@ +const tailwindcss = require("tailwindcss"); +const autoprefixer = require("autoprefixer"); + +const config = { + plugins: [ + //Some plugins, like tailwindcss/nesting, need to run before Tailwind, + tailwindcss(), + //But others, like autoprefixer, need to run after, + autoprefixer, + ], +}; + +module.exports = config; diff --git a/AgentQnA/ui/svelte/src/app.d.ts b/AgentQnA/ui/svelte/src/app.d.ts new file mode 100644 index 0000000000..76f5cae98c --- /dev/null +++ b/AgentQnA/ui/svelte/src/app.d.ts @@ -0,0 +1,50 @@ +// Copyright (C) 2025 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 + +// See: https://kit.svelte.dev/docs/types#app +// import { Result} from "neverthrow"; + +declare namespace App { + interface Locals { + user?: User; + } + // interface PageData { } + // interface PageError {} + // interface Platform {} +} + +interface User { + id?: string; + email: string; + password?: string; + token?: string; + [key: string]: any; +} + +type AuthResponse = Result; + +interface AuthAdapter { + login(props: { email: string; password: string }): Promise; + signup(props: { email: string; password: string; password_confirm: string }): Promise; + validate_session(props: { token: string }): Promise; + logout(props: { token: string; email: string }): Promise>; + forgotPassword(props: { email: string; password: string }): Promise>; +} + +interface ChatAdapter { + modelList(props: {}): Promise>; + txt2img(props: {}): Promise>; +} + +interface ChatMessage { + role: string; + content: string; +} + +interface ChatMessageType { + model: string; + knowledge: string; + temperature: string; + max_new_tokens: string; + topk: string; +} diff --git a/AgentQnA/ui/svelte/src/app.html b/AgentQnA/ui/svelte/src/app.html new file mode 100644 index 0000000000..5baaf1750e --- /dev/null +++ b/AgentQnA/ui/svelte/src/app.html @@ -0,0 +1,17 @@ + + + + + + + + + %sveltekit.head% + + +
%sveltekit.body%
+ + diff --git a/AgentQnA/ui/svelte/src/app.postcss b/AgentQnA/ui/svelte/src/app.postcss new file mode 100644 index 0000000000..c3e0519c6a --- /dev/null +++ b/AgentQnA/ui/svelte/src/app.postcss @@ -0,0 +1,82 @@ +/* Write your global styles here, in PostCSS syntax */ +@tailwind base; +@tailwind components; +@tailwind utilities; + +.btn { + @apply flex-nowrap; +} +a.btn { + @apply no-underline; +} +.input { + @apply text-base; +} + +.bg-dark-blue { + background-color: #004a86; +} + +.bg-light-blue { + background-color: #0068b5; +} + +.bg-turquoise { + background-color: #00a3f6; +} + +.bg-header { + background-color: #ffffff; +} + +.bg-button { + background-color: #0068b5; +} + +.bg-title { + background-color: #f7f7f7; +} + +.text-header { + color: #0068b5; +} + +.text-button { + color: #0071c5; +} + +.text-title-color { + color: rgb(38,38,38); +} + +.font-intel { + font-family: "intel-clear","tahoma",Helvetica,"helvetica",Arial,sans-serif; +} + +.font-title-intel { + font-family: "intel-one","intel-clear",Helvetica,Arial,sans-serif; +} + +.bg-footer { + background-color: #e7e7e7; +} + +.bg-light-green { + background-color: #d7f3a1; +} + +.bg-purple { + background-color: #653171; +} + +.bg-dark-blue { + background-color: #224678; +} + +.border-input-color { + border-color: #605e5c; +} + +.w-12\/12 { + width: 100% +} \ No newline at end of file diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/createSub.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/createSub.svelte new file mode 100644 index 0000000000..b31044d0fc --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/createSub.svelte @@ -0,0 +1,25 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/download.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/download.svelte new file mode 100644 index 0000000000..da8bcefb3d --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/download.svelte @@ -0,0 +1,9 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/eye.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/eye.svelte new file mode 100644 index 0000000000..06f9a821e4 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/eye.svelte @@ -0,0 +1,16 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/newAI.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/newAI.svelte new file mode 100644 index 0000000000..6fc1179daf --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/newAI.svelte @@ -0,0 +1,97 @@ + + + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/resource.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/resource.svelte new file mode 100644 index 0000000000..6460bb34d2 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/resource.svelte @@ -0,0 +1,8 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/search.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/search.svelte new file mode 100644 index 0000000000..79c22c7b2f --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/search.svelte @@ -0,0 +1,13 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/searchDelete.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/searchDelete.svelte new file mode 100644 index 0000000000..e6907c21df --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/searchDelete.svelte @@ -0,0 +1,17 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/searchResult.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/searchResult.svelte new file mode 100644 index 0000000000..378f3cdf50 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/searchResult.svelte @@ -0,0 +1,20 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/star.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/star.svelte new file mode 100644 index 0000000000..1a0e4175cc --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/star.svelte @@ -0,0 +1,22 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/summary.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/summary.svelte new file mode 100644 index 0000000000..952c986061 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/summary.svelte @@ -0,0 +1,44 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/taskIcon.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/taskIcon.svelte new file mode 100644 index 0000000000..737b7a8cbc --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/taskIcon.svelte @@ -0,0 +1,24 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/taskResult.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/taskResult.svelte new file mode 100644 index 0000000000..f4b3833002 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/taskResult.svelte @@ -0,0 +1,60 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/time.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/time.svelte new file mode 100644 index 0000000000..140f544c82 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/time.svelte @@ -0,0 +1,8 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/Agent/toolIcon.svelte b/AgentQnA/ui/svelte/src/lib/assets/Agent/toolIcon.svelte new file mode 100644 index 0000000000..342f5df387 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/Agent/toolIcon.svelte @@ -0,0 +1,36 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/ActiveDislikeButtonIcon.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/ActiveDislikeButtonIcon.svelte new file mode 100644 index 0000000000..b5c1ea06b0 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/ActiveDislikeButtonIcon.svelte @@ -0,0 +1,28 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/ActiveLikeButtonIcon.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/ActiveLikeButtonIcon.svelte new file mode 100644 index 0000000000..b410c73386 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/ActiveLikeButtonIcon.svelte @@ -0,0 +1,24 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/Folder.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/Folder.svelte new file mode 100644 index 0000000000..c338962899 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/Folder.svelte @@ -0,0 +1,28 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/Knowledge.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/Knowledge.svelte new file mode 100644 index 0000000000..7b1593d757 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/Knowledge.svelte @@ -0,0 +1,38 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/NoTranslate.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/NoTranslate.svelte new file mode 100644 index 0000000000..7f94dcef9c --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/NoTranslate.svelte @@ -0,0 +1,32 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/OldHelp.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/OldHelp.svelte new file mode 100644 index 0000000000..71c3cfb132 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/OldHelp.svelte @@ -0,0 +1,41 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/Question.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/Question.svelte new file mode 100644 index 0000000000..c4f296e2c2 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/Question.svelte @@ -0,0 +1,6 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/addKnowledge.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/addKnowledge.svelte new file mode 100644 index 0000000000..001de15b19 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/addKnowledge.svelte @@ -0,0 +1,92 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/adminKnowledge.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/adminKnowledge.svelte new file mode 100644 index 0000000000..2ec562e6ae --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/adminKnowledge.svelte @@ -0,0 +1,229 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/arrow-path-icon.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/arrow-path-icon.svelte new file mode 100644 index 0000000000..cecb4b1273 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/arrow-path-icon.svelte @@ -0,0 +1,25 @@ + + + + + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/assistant.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/assistant.svelte new file mode 100644 index 0000000000..73e947fa4b --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/assistant.svelte @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/chat-bubble-left-icon.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/chat-bubble-left-icon.svelte new file mode 100644 index 0000000000..9ea21455b0 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/chat-bubble-left-icon.svelte @@ -0,0 +1,25 @@ + + + + + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/chat.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/chat.svelte new file mode 100644 index 0000000000..d62154acad --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/chat.svelte @@ -0,0 +1,6 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/check-icon.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/check-icon.svelte new file mode 100644 index 0000000000..5905fc0866 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/check-icon.svelte @@ -0,0 +1,25 @@ + + + + + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/csv.svg b/AgentQnA/ui/svelte/src/lib/assets/icons/csv.svg new file mode 100644 index 0000000000..1e808ba6cf --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/csv.svg @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/dislikeButtonIcon.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/dislikeButtonIcon.svelte new file mode 100644 index 0000000000..2ae9f8ed84 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/dislikeButtonIcon.svelte @@ -0,0 +1,28 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/download-directory.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/download-directory.svelte new file mode 100644 index 0000000000..d5ad5fb259 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/download-directory.svelte @@ -0,0 +1,16 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/likeButtonIcon.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/likeButtonIcon.svelte new file mode 100644 index 0000000000..aaabc6c072 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/likeButtonIcon.svelte @@ -0,0 +1,24 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/loading-button-spinner-icon.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/loading-button-spinner-icon.svelte new file mode 100644 index 0000000000..9be0ceb5b2 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/loading-button-spinner-icon.svelte @@ -0,0 +1,25 @@ + + + + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/message-avatar.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/message-avatar.svelte new file mode 100644 index 0000000000..0cbe61c7ed --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/message-avatar.svelte @@ -0,0 +1,17 @@ + + + + +{#if role === "Assistant"} + +{:else} + +{/if} diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/no-file.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/no-file.svelte new file mode 100644 index 0000000000..2e22f76cd0 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/no-file.svelte @@ -0,0 +1,37 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/paper-airplane.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/paper-airplane.svelte new file mode 100644 index 0000000000..6ee8c19f1c --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/paper-airplane.svelte @@ -0,0 +1,27 @@ + + + + + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/paste-link.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/paste-link.svelte new file mode 100644 index 0000000000..79f5b4d351 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/paste-link.svelte @@ -0,0 +1,20 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/pencil-square-icon.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/pencil-square-icon.svelte new file mode 100644 index 0000000000..3b55df66c1 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/pencil-square-icon.svelte @@ -0,0 +1,25 @@ + + + + + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/plus-icon.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/plus-icon.svelte new file mode 100644 index 0000000000..e97c9d6fbb --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/plus-icon.svelte @@ -0,0 +1,27 @@ + + + + + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/portrait.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/portrait.svelte new file mode 100644 index 0000000000..2f9828b88c --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/portrait.svelte @@ -0,0 +1,20 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/translateIcon.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/translateIcon.svelte new file mode 100644 index 0000000000..47a2f38ea1 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/translateIcon.svelte @@ -0,0 +1,32 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/trash-icon.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/trash-icon.svelte new file mode 100644 index 0000000000..363430c6d8 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/trash-icon.svelte @@ -0,0 +1,25 @@ + + + + + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/upload-directory.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/upload-directory.svelte new file mode 100644 index 0000000000..2020d107f3 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/upload-directory.svelte @@ -0,0 +1,14 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/upload-files.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/upload-files.svelte new file mode 100644 index 0000000000..59913cbedc --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/upload-files.svelte @@ -0,0 +1,14 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/upoadKnowledge.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/upoadKnowledge.svelte new file mode 100644 index 0000000000..a9f3f8f813 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/upoadKnowledge.svelte @@ -0,0 +1,6 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/warning.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/warning.svelte new file mode 100644 index 0000000000..ba821a9a48 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/warning.svelte @@ -0,0 +1,22 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/assets/icons/x-mark-icon.svelte b/AgentQnA/ui/svelte/src/lib/assets/icons/x-mark-icon.svelte new file mode 100644 index 0000000000..8df3b7a20d --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/assets/icons/x-mark-icon.svelte @@ -0,0 +1,20 @@ + + + diff --git a/AgentQnA/ui/svelte/src/lib/common/sse.d.ts b/AgentQnA/ui/svelte/src/lib/common/sse.d.ts new file mode 100644 index 0000000000..c3f8ed69d6 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/common/sse.d.ts @@ -0,0 +1,15 @@ +// Copyright (C) 2025 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 + +declare module "sse.js" { + export type SSEOptions = EventSourceInit & { + headers?: Record; + payload?: string; + method?: string; + }; + + export class SSE extends EventSource { + constructor(url: string | URL, sseOptions?: SSEOptions); + stream(): void; + } +} diff --git a/AgentQnA/ui/svelte/src/lib/common/timediff.ts b/AgentQnA/ui/svelte/src/lib/common/timediff.ts new file mode 100644 index 0000000000..09d191d8ae --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/common/timediff.ts @@ -0,0 +1,26 @@ +// Copyright (C) 2025 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 + +export default function timeDifference(current: number, previous: number) { + const msPerMinute = 60 * 1000; + const msPerHour = msPerMinute * 60; + const msPerDay = msPerHour * 24; + const msPerMonth = msPerDay * 30; + const msPerYear = msPerDay * 365; + + const elapsed = current - previous; + + if (elapsed < msPerMinute) { + return Math.round(elapsed / 1000) + " seconds ago"; + } else if (elapsed < msPerHour) { + return Math.round(elapsed / msPerMinute) + " minutes ago"; + } else if (elapsed < msPerDay) { + return Math.round(elapsed / msPerHour) + " hours ago"; + } else if (elapsed < msPerMonth) { + return "approximately " + Math.round(elapsed / msPerDay) + " days ago"; + } else if (elapsed < msPerYear) { + return "approximately " + Math.round(elapsed / msPerMonth) + " months ago"; + } else { + return "approximately " + Math.round(elapsed / msPerYear) + " years ago"; + } +} diff --git a/AgentQnA/ui/svelte/src/lib/components/agent/loadingStatic.svelte b/AgentQnA/ui/svelte/src/lib/components/agent/loadingStatic.svelte new file mode 100644 index 0000000000..e100fce92a --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/components/agent/loadingStatic.svelte @@ -0,0 +1,16 @@ + + +
+
+
+
+
+
+
+
+
+
+
diff --git a/AgentQnA/ui/svelte/src/lib/components/chat/chat.svelte b/AgentQnA/ui/svelte/src/lib/components/chat/chat.svelte new file mode 100644 index 0000000000..b140e7d1b4 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/components/chat/chat.svelte @@ -0,0 +1,239 @@ + + + + + + AI Agent + + + + +
+ {#if chatMessages.length === 0 && query === ""} + + {:else if showAgent || chatMessages.length > 0} +
+
+
+ +
+

+ {agentName} +

+ +

+ {agentDescripe} +

+
+
+
+
+
+ {#if loading} +
+ +
+ {:else} + + {/if} +
+ + + + +
+
+
+
+ {/if} +
diff --git a/AgentQnA/ui/svelte/src/lib/components/chat/history.svelte b/AgentQnA/ui/svelte/src/lib/components/chat/history.svelte new file mode 100644 index 0000000000..81d9c277f4 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/components/chat/history.svelte @@ -0,0 +1,166 @@ + + + + + diff --git a/AgentQnA/ui/svelte/src/lib/components/chat/loadingAnimation.svelte b/AgentQnA/ui/svelte/src/lib/components/chat/loadingAnimation.svelte new file mode 100644 index 0000000000..5adffb1d0a --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/components/chat/loadingAnimation.svelte @@ -0,0 +1,37 @@ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AgentQnA/ui/svelte/src/lib/components/content.svelte b/AgentQnA/ui/svelte/src/lib/components/content.svelte new file mode 100644 index 0000000000..b09f31fadd --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/components/content.svelte @@ -0,0 +1,33 @@ + + + + +
+ + +
+ {#key currentChatID} + + {/key} +
+
diff --git a/AgentQnA/ui/svelte/src/lib/components/create.svelte b/AgentQnA/ui/svelte/src/lib/components/create.svelte new file mode 100644 index 0000000000..4d7595b1e4 --- /dev/null +++ b/AgentQnA/ui/svelte/src/lib/components/create.svelte @@ -0,0 +1,238 @@ + + + + +
+

+ + Create Agent +

+ +
+
+
+ +
+
+ +
+
+
+ +
+ +
+