Skip to content

Commit 8bb681c

Browse files
authored
MGMT-22746: Add chatbot app (#3350)
* Add chatbot app * Update deps * Add README * Address review comments
1 parent 9b20485 commit 8bb681c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+6404
-719
lines changed

.eslintrc.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"node": true
77
},
88
"parserOptions": {
9+
"ecmaVersion": "latest",
910
"project": [
1011
"apps/*/tsconfig.eslint.json",
1112
"libs/*/tsconfig.eslint.json",
@@ -21,6 +22,9 @@
2122
"ignorePatterns": [
2223
"apps/*/build",
2324
"libs/*/build",
24-
"tools/*/build"
25+
"tools/*/build",
26+
"apps/*/dist",
27+
"libs/*/dist",
28+
"tools/*/dist"
2529
]
2630
}

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,3 @@ package-lock.json
3838
!.yarn/releases
3939
!.yarn/sdks
4040
!.yarn/versions
41-
42-
# Ignored apps
43-
apps/*
44-
!apps/assisted-ui
45-
!apps/assisted-disconnected-ui
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/** @type {import('eslint').ESLint.ConfigData} */
2+
module.exports = {
3+
overrides: [
4+
{
5+
files: ['./vite.config.ts'],
6+
extends: ['@openshift-assisted/eslint-config'],
7+
env: {
8+
browser: false,
9+
},
10+
parserOptions: {
11+
tsconfigRootDir: __dirname,
12+
},
13+
rules: {
14+
'no-console': 'off',
15+
},
16+
},
17+
{
18+
files: ['./src/**/*.{ts,tsx}'],
19+
extends: ['@openshift-assisted/eslint-config', 'plugin:react/jsx-runtime'],
20+
parserOptions: {
21+
tsconfigRootDir: __dirname,
22+
},
23+
rules: {
24+
'no-restricted-imports': [
25+
'error',
26+
{
27+
paths: [
28+
{
29+
name: 'react-i18next',
30+
importNames: ['useTranslation'],
31+
message: 'Import `useTranslation` from `@openshift-assisted/ui-lib/common` instead',
32+
},
33+
],
34+
},
35+
],
36+
},
37+
},
38+
],
39+
};

apps/assisted-chatbot/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Assisted Installer Chatbot UI
2+
3+
This is a federated module for
4+
[Astro Virtual Assistant UI](https://github.com/RedHatInsights/astro-virtual-assistant-frontend)
5+
6+
## Run the project
7+
8+
1. Run the Astro
9+
1. For now you need to use my fork which can load this new assisted chatbot module - clone the
10+
repo
11+
[Astro fork](https://github.com/rawagner/astro-virtual-assistant-frontend/tree/chatbot_app)
12+
2. run `npm install`
13+
3. start the Astro `npm run start`
14+
2. Run the Assisted Chatbot
15+
16+
1. run `yarn start:assisted_chatbot:static`
17+
18+
3. Open [c.rh.c](https://prod.foo.redhat.com:1337/). The chatbot will appear on the bottom left
19+
corner. You should be able to choose Assisted Installer chatbot
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
apiVersion: v1
3+
kind: Template
4+
metadata:
5+
name: assisted-installer-ui-chatbot
6+
objects:
7+
- apiVersion: cloud.redhat.com/v1alpha1
8+
kind: Frontend
9+
metadata:
10+
name: assisted-installer-ui-chatbot
11+
spec:
12+
feoConfigEnabled: true
13+
envName: ${ENV_NAME}
14+
title: Assisted Installer UI Chatbot
15+
deploymentRepo: https://github.com/openshift-assisted/assisted-installer-ui
16+
frontend:
17+
paths:
18+
- /apps/assisted-installer-ui-chatbot
19+
API:
20+
versions:
21+
- v1
22+
image: ${IMAGE}:${IMAGE_TAG}
23+
module:
24+
manifestLocation: '/apps/assisted-installer-ui-chatbot/fed-mods.json'
25+
moduleConfig:
26+
ssoScopes:
27+
- rhfull
28+
parameters:
29+
- name: ENV_NAME
30+
required: true
31+
- name: IMAGE_TAG
32+
required: true
33+
- name: IMAGE
34+
value: quay.io/app-sre/assisted-installer-ui-chatbot
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const path = require('path');
2+
const { insights } = require('./package.json');
3+
const moduleName = insights.appname.replace(/-(\w)/g, (_, match) => match.toUpperCase());
4+
5+
module.exports = {
6+
appUrl: '/openshift/assisted-installer-ui-chatbot',
7+
appEntry: path.resolve(__dirname, './src/AppEntry.tsx'),
8+
debug: true,
9+
useProxy: true,
10+
proxyVerbose: true,
11+
stripAllPfStyles: true,
12+
sassPrefix: `.${moduleName}`,
13+
interceptChromeConfig: false,
14+
plugins: [],
15+
hotReload: process.env.HOT === 'true',
16+
nodeModulesDirectories: '../../node_modules',
17+
moduleFederation: {
18+
exposes: {
19+
'./ChatbotMessageEntry': path.resolve(
20+
__dirname,
21+
'./src/components/ChatbotMessageEntry/ChatbotMessageEntry.tsx',
22+
),
23+
'./useAsyncChatbot': path.resolve(__dirname, './src/hooks/useAsyncChatbot.tsx'),
24+
},
25+
},
26+
routes: {
27+
'/apps/assisted-installer-ui-chatbot': { host: 'http://localhost:8003' },
28+
},
29+
};

apps/assisted-chatbot/package.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "@openshift-assisted/assisted-installer-ui-chatbot",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"engines": {
6+
"node": ">=16.0.0",
7+
"npm": ">=7.0.0"
8+
},
9+
"scripts": {
10+
"build": "fec build",
11+
"check_types": "yarn run -T tsc --noEmit",
12+
"clean": "yarn run -T rimraf node_modules dist .cache",
13+
"patch:hosts": "fec patch-etc-hosts",
14+
"format": "yarn run -T prettier --cache --check . \"!dist\"",
15+
"fix-code-style": "yarn lint --fix && yarn format --write",
16+
"lint": "yarn run -T eslint --cache --cache-location node_modules/.cache/eslint/.eslint-cache .",
17+
"start": "HOT=true fec dev --clouddotEnv=prod --uiEnv=stable",
18+
"start:static": "fec static --port=7003 --config ../../node_modules/@redhat-cloud-services/frontend-components-config/bin/prod.webpack.config.js",
19+
"static": "fec static",
20+
"postinstall": "ts-patch install"
21+
},
22+
"dependencies": {
23+
"@openshift-assisted/chatbot": "workspace:*",
24+
"@patternfly/chatbot": "6.4.1",
25+
"@patternfly/patternfly": "6.4.0",
26+
"@patternfly/react-core": "6.4.0",
27+
"@patternfly/react-icons": "6.4.0",
28+
"@patternfly/react-styles": "6.4.0",
29+
"@patternfly/react-tokens": "6.4.0",
30+
"@redhat-cloud-services/ai-client-common": "^0.13.0",
31+
"@redhat-cloud-services/ai-client-state": "^0.15.0",
32+
"@redhat-cloud-services/frontend-components": "^7.0.0",
33+
"axios": ">=0.22.0 <2.0.0",
34+
"i18next": "^20.4.0",
35+
"parse-url": "^9.2.0",
36+
"react": "^18.2.0",
37+
"react-dom": "^18.2.0",
38+
"react-i18next": "^11.11.4",
39+
"react-router-dom-v5-compat": "^6.21.2"
40+
},
41+
"devDependencies": {
42+
"@redhat-cloud-services/eslint-config-redhat-cloud-services": "^2.0.3",
43+
"@redhat-cloud-services/frontend-components-config": "^6.0.17",
44+
"@redhat-cloud-services/tsc-transform-imports": "^1.0.4",
45+
"@tsconfig/vite-react": "^1.0.1",
46+
"@types/react": "18.2.37",
47+
"@types/react-dom": "^18.2.0",
48+
"rimraf": "^5.0.5",
49+
"ts-patch": "^3.0.2",
50+
"typescript": "^5.2.2"
51+
},
52+
"insights": {
53+
"appname": "assisted-installer-ui-chatbot"
54+
}
55+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Minimal entry point for fec dev server
2+
// This module only exposes federated components, no standalone app
3+
import React from 'react';
4+
5+
const AppEntry: React.FC = () => {
6+
return null;
7+
};
8+
9+
export default AppEntry;
Lines changed: 33 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.ai-async-message-skeleton--slow {
2+
--pf-v6-c-skeleton--after--AnimationDuration: 3.6s;
3+
}

0 commit comments

Comments
 (0)