cmcts-c-agent-embedding 1.0.22 → 1.0.23-vpcp
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +12 -6
- package/.idea/{Flowise-share-chatbox.iml → flowise-chatbox.iml} +0 -1
- package/.idea/modules.xml +1 -2
- package/.idea/vcs.xml +5 -6
- package/AGENTS.md +166 -0
- package/CLAUDE.md +77 -0
- package/README.md +349 -349
- package/auggie_shell_conversation.txt +23 -0
- package/auggie_shell_user_request.txt +20 -0
- package/dist/BubbleChat.d.ts +9 -12
- package/dist/BubbleChat.d.ts.map +1 -1
- package/dist/FullPageChat.d.ts +17 -17
- package/dist/components/Badge.d.ts.map +1 -1
- package/dist/components/Bot.d.ts +6 -16
- package/dist/components/Bot.d.ts.map +1 -1
- package/dist/components/Toast.d.ts +10 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/avatars/DefaultAvatar.d.ts.map +1 -1
- package/dist/components/bubbles/AgentReasoningBubble.d.ts +0 -2
- package/dist/components/bubbles/AgentReasoningBubble.d.ts.map +1 -1
- package/dist/components/bubbles/BotBubble.d.ts +6 -0
- package/dist/components/bubbles/BotBubble.d.ts.map +1 -1
- package/dist/components/bubbles/ChartBubble.d.ts +73 -0
- package/dist/components/bubbles/ChartBubble.d.ts.map +1 -0
- package/dist/components/bubbles/ChartLoadingPlaceholder.d.ts +8 -0
- package/dist/components/bubbles/ChartLoadingPlaceholder.d.ts.map +1 -0
- package/dist/components/bubbles/ChartPlaceholder.d.ts +20 -0
- package/dist/components/bubbles/ChartPlaceholder.d.ts.map +1 -0
- package/dist/components/bubbles/ChartPopupModal.d.ts +4 -0
- package/dist/components/bubbles/ChartPopupModal.d.ts.map +1 -0
- package/dist/components/bubbles/ChartPortalContainer.d.ts +12 -0
- package/dist/components/bubbles/ChartPortalContainer.d.ts.map +1 -0
- package/dist/components/bubbles/GuestBubble.d.ts.map +1 -1
- package/dist/components/bubbles/LeadCaptureBubble.d.ts.map +1 -1
- package/dist/components/bubbles/LoadingBubble.d.ts.map +1 -1
- package/dist/components/bubbles/SourceBubble.d.ts.map +1 -1
- package/dist/components/bubbles/StableChartWrapper.d.ts +18 -0
- package/dist/components/bubbles/StableChartWrapper.d.ts.map +1 -0
- package/dist/components/buttons/CopyMessageButton.d.ts +10 -0
- package/dist/components/buttons/CopyMessageButton.d.ts.map +1 -0
- package/dist/components/buttons/EditMessageButton.d.ts +8 -0
- package/dist/components/buttons/EditMessageButton.d.ts.map +1 -0
- package/dist/components/buttons/PopupToast.d.ts +7 -0
- package/dist/components/buttons/PopupToast.d.ts.map +1 -0
- package/dist/components/buttons/SendButton.d.ts.map +1 -1
- package/dist/components/dialogs/EditMessageDialog.d.ts +9 -0
- package/dist/components/dialogs/EditMessageDialog.d.ts.map +1 -0
- package/dist/components/icons/CheckIcon.d.ts +3 -0
- package/dist/components/icons/CheckIcon.d.ts.map +1 -0
- package/dist/components/icons/CmcIcon.d.ts +3 -0
- package/dist/components/icons/CmcIcon.d.ts.map +1 -0
- package/dist/components/icons/CopyIcon.d.ts +5 -0
- package/dist/components/icons/CopyIcon.d.ts.map +1 -0
- package/dist/components/icons/EditIcon.d.ts +5 -0
- package/dist/components/icons/EditIcon.d.ts.map +1 -0
- package/dist/components/icons/FullScreenIcon.d.ts +3 -0
- package/dist/components/icons/FullScreenIcon.d.ts.map +1 -0
- package/dist/components/icons/ResetBtn.d.ts +3 -0
- package/dist/components/icons/ResetBtn.d.ts.map +1 -0
- package/dist/components/icons/ResetZoomIcon.d.ts +3 -0
- package/dist/components/icons/ResetZoomIcon.d.ts.map +1 -0
- package/dist/components/icons/SendIconOff.d.ts +3 -0
- package/dist/components/icons/SendIconOff.d.ts.map +1 -0
- package/dist/components/icons/SendIconOn.d.ts +3 -0
- package/dist/components/icons/SendIconOn.d.ts.map +1 -0
- package/dist/components/icons/ZoomInIcon.d.ts +3 -0
- package/dist/components/icons/ZoomInIcon.d.ts.map +1 -0
- package/dist/components/icons/ZoomOutIcon.d.ts +3 -0
- package/dist/components/icons/ZoomOutIcon.d.ts.map +1 -0
- package/dist/components/icons/index.d.ts +1 -1
- package/dist/components/icons/index.d.ts.map +1 -1
- package/dist/components/image/PreviewImage.d.ts +5 -0
- package/dist/components/image/PreviewImage.d.ts.map +1 -0
- package/dist/components/inputs/textInput/components/ShortTextInput.d.ts +3 -0
- package/dist/components/inputs/textInput/components/ShortTextInput.d.ts.map +1 -1
- package/dist/components/inputs/textInput/components/TextInput.d.ts +5 -5
- package/dist/components/inputs/textInput/components/TextInput.d.ts.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/features/bubble/components/Bubble.d.ts.map +1 -1
- package/dist/features/bubble/components/BubbleButton.d.ts.map +1 -1
- package/dist/features/bubble/types.d.ts +1 -0
- package/dist/features/bubble/types.d.ts.map +1 -1
- package/dist/features/full/components/Full.d.ts.map +1 -1
- package/dist/features/popup/components/DisclaimerPopup.d.ts.map +1 -1
- package/dist/features/popup/components/Popup.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/queries/sendMessageQuery.d.ts +10 -15
- package/dist/queries/sendMessageQuery.d.ts.map +1 -1
- package/dist/types/chart.d.ts +86 -0
- package/dist/types/chart.d.ts.map +1 -0
- package/dist/utils/chartConfigManager.d.ts +54 -0
- package/dist/utils/chartConfigManager.d.ts.map +1 -0
- package/dist/utils/chartInstanceManager.d.ts +43 -0
- package/dist/utils/chartInstanceManager.d.ts.map +1 -0
- package/dist/utils/chartPopupManager.d.ts +43 -0
- package/dist/utils/chartPopupManager.d.ts.map +1 -0
- package/dist/utils/chartPortalManager.d.ts +76 -0
- package/dist/utils/chartPortalManager.d.ts.map +1 -0
- package/dist/utils/chartTagParser.d.ts +39 -0
- package/dist/utils/chartTagParser.d.ts.map +1 -0
- package/dist/utils/isMobileSignal.d.ts +3 -1
- package/dist/utils/isMobileSignal.d.ts.map +1 -1
- package/dist/utils/security.d.ts +50 -0
- package/dist/utils/security.d.ts.map +1 -0
- package/dist/utils/textStreamSmoother.d.ts +40 -0
- package/dist/utils/textStreamSmoother.d.ts.map +1 -0
- package/dist/utils/transcriptApi.d.ts +8 -0
- package/dist/utils/transcriptApi.d.ts.map +1 -0
- package/dist/utils/ultimateJsonParser.d.ts +2 -0
- package/dist/utils/ultimateJsonParser.d.ts.map +1 -0
- package/dist/web.d.ts +2 -0
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +1 -1
- package/dist/window.d.ts +1 -0
- package/dist/window.d.ts.map +1 -1
- package/package.json +21 -15
- package/public/Chat_Mobile_Header_BG.png +0 -0
- package/public/HuyHieuBoCongAn.png +0 -0
- package/public/Logo_VNeID.png +0 -0
- package/public/People_TroLy.png +0 -0
- package/public/People_TroLy_Icon.png +0 -0
- package/public/TroLyAI_Icon.png +0 -0
- package/public/icon_bot.png +0 -0
- package/public/index.html +7 -119
- package/public/logo.png +0 -0
- package/public/robots.txt +16 -0
- package/public/sitemap.xml +9 -0
- package/server.js +523 -401
- package/.env +0 -36
- package/.husky/pre-commit +0 -18
- package/.idea/codeStyles/Project.xml +0 -60
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -16
- package/.idea/prettier.xml +0 -6
- package/a.json +0 -57
- package/bun.lockb +0 -0
- package/dist/components/ImageUploadButton.d.ts +0 -11
- package/dist/components/ImageUploadButton.d.ts.map +0 -1
- package/dist/components/RecordAudioButton.d.ts +0 -11
- package/dist/components/RecordAudioButton.d.ts.map +0 -1
- package/dist/components/SendButton.d.ts +0 -12
- package/dist/components/SendButton.d.ts.map +0 -1
- package/test.html +0 -17
package/.env.example
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
# ==============================================
|
|
4
4
|
|
|
5
5
|
# API Host URL (required)
|
|
6
|
-
# This should be the URL where your
|
|
7
|
-
# Example: https://your-
|
|
6
|
+
# This should be the URL where your CAgent instance is running
|
|
7
|
+
# Example: https://your-cagent-instance.com
|
|
8
8
|
API_HOST=
|
|
9
9
|
|
|
10
|
-
#
|
|
11
|
-
# Generate this from your
|
|
10
|
+
# CAgent API Key (required)
|
|
11
|
+
# Generate this from your CAgent instance settings page
|
|
12
12
|
# Example: OxxGE-h_LaH7ZYorStjTOik1XY999RxxoHpCSYl8BXxc
|
|
13
|
-
|
|
13
|
+
CAGENT_API_KEY=
|
|
14
14
|
|
|
15
15
|
# ==============================================
|
|
16
16
|
# CHATFLOWS CONFIGURATION (required)
|
|
@@ -20,7 +20,7 @@ FLOWISE_API_KEY=
|
|
|
20
20
|
#
|
|
21
21
|
# Each entry consists of:
|
|
22
22
|
# - identifier: Any name you choose (e.g., agent1, support, salesbot)
|
|
23
|
-
# - chatflowId: The UUID of your
|
|
23
|
+
# - chatflowId: The UUID of your CAgent chatflow
|
|
24
24
|
# - allowedDomains: Comma-separated list of domains where this chat can be embedded
|
|
25
25
|
# Note: Wildcard domains (*) are not supported for security reasons
|
|
26
26
|
#
|
|
@@ -32,3 +32,9 @@ FLOWISE_API_KEY=
|
|
|
32
32
|
# Add your chatflows below:
|
|
33
33
|
chatflow_1=
|
|
34
34
|
chatflow_2=
|
|
35
|
+
|
|
36
|
+
# ==============================================
|
|
37
|
+
# OPTIONAL CONFIGURATION
|
|
38
|
+
# ==============================================
|
|
39
|
+
|
|
40
|
+
|
package/.idea/modules.xml
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
<project version="4">
|
|
3
3
|
<component name="ProjectModuleManager">
|
|
4
4
|
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/
|
|
6
|
-
<module fileurl="file://$PROJECT_DIR$/../Flowise-share-chatbox-main/.idea/Flowise-share-chatbox-main.iml" filepath="$PROJECT_DIR$/../Flowise-share-chatbox-main/.idea/Flowise-share-chatbox-main.iml" />
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/flowise-chatbox.iml" filepath="$PROJECT_DIR$/.idea/flowise-chatbox.iml" />
|
|
7
6
|
</modules>
|
|
8
7
|
</component>
|
|
9
8
|
</project>
|
package/.idea/vcs.xml
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="VcsDirectoryMappings">
|
|
4
|
-
<mapping directory="" vcs="Git" />
|
|
5
|
-
|
|
6
|
-
</component>
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="VcsDirectoryMappings">
|
|
4
|
+
<mapping directory="" vcs="Git" />
|
|
5
|
+
</component>
|
|
7
6
|
</project>
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# AGENTS.md - Coding Guidelines
|
|
2
|
+
|
|
3
|
+
> **Purpose:** Guidelines for code quality, development process, and decision-making
|
|
4
|
+
> **Target Audience:** AI coding assistants and developers
|
|
5
|
+
> **Version:** 1.0
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Code Quality Standards
|
|
10
|
+
|
|
11
|
+
### Core Principles
|
|
12
|
+
|
|
13
|
+
#### No Unused Code
|
|
14
|
+
- **Rule:** Don't write unused code
|
|
15
|
+
- **Requirement:** Ensure everything written is utilized in the project
|
|
16
|
+
- **Priority:** Critical
|
|
17
|
+
|
|
18
|
+
#### Readability First
|
|
19
|
+
- **Rule:** Prioritize readability for human understanding over execution efficiency
|
|
20
|
+
- **Priority:** Critical
|
|
21
|
+
|
|
22
|
+
#### Maintainability
|
|
23
|
+
- **Rule:** Maintain long-term maintainability over short-term optimization
|
|
24
|
+
- **Priority:** High
|
|
25
|
+
|
|
26
|
+
#### Simplicity
|
|
27
|
+
- **Rule:** Avoid unnecessary complexity
|
|
28
|
+
- **Approach:** Implement simple solutions unless complexity is truly required
|
|
29
|
+
- **Priority:** High
|
|
30
|
+
|
|
31
|
+
#### Clean Code Philosophy
|
|
32
|
+
- **Rule:** Follow Linus Torvalds' clean code principles
|
|
33
|
+
- **Priority:** High
|
|
34
|
+
- **Guidelines:**
|
|
35
|
+
1. Keep it simple
|
|
36
|
+
2. Make code readable like prose
|
|
37
|
+
3. Avoid premature optimization
|
|
38
|
+
4. Express intent clearly
|
|
39
|
+
5. Minimize abstraction layers
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### Documentation Standards
|
|
44
|
+
|
|
45
|
+
#### Comment Purpose
|
|
46
|
+
- **Rule:** Comments must explain "what" (business logic/purpose) and "why" (reasoning/decisions), not "how"
|
|
47
|
+
- **Priority:** High
|
|
48
|
+
|
|
49
|
+
#### Avoid Over-Commenting
|
|
50
|
+
- **Rule:** Avoid over-commenting
|
|
51
|
+
- **Rationale:** Excessive comments indicate poor code quality
|
|
52
|
+
- **Priority:** Medium
|
|
53
|
+
|
|
54
|
+
#### Function Comments
|
|
55
|
+
- **Rule:** Function comments must explain purpose and reasoning
|
|
56
|
+
- **Placement:** Placed at function beginnings
|
|
57
|
+
- **Priority:** Medium
|
|
58
|
+
|
|
59
|
+
#### Self-Explanatory Code
|
|
60
|
+
- **Rule:** Well-written code should be self-explanatory
|
|
61
|
+
- **Method:** Through meaningful names and clear structure
|
|
62
|
+
- **Priority:** High
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Development Process
|
|
67
|
+
|
|
68
|
+
> **Description:** Follow these steps in order for effective development
|
|
69
|
+
> **Priority:** Critical
|
|
70
|
+
|
|
71
|
+
| Step | Name | Action/Rationale | Importance |
|
|
72
|
+
|------|------|------------------|------------|
|
|
73
|
+
| 1 | Understand First | Use available tools to understand data structures before implementation | Critical |
|
|
74
|
+
| 2 | Design Data Structures | Good data structures lead to good code | Critical |
|
|
75
|
+
| 3 | Define Interfaces | Specify all input/output structures before writing logic | High |
|
|
76
|
+
| 4 | Define Functions | Create all function signatures before implementation | High |
|
|
77
|
+
| 5 | Implement Logic | Write implementation only after structures and definitions are complete | High |
|
|
78
|
+
| 6 | Validate Code Quality | Always run lint and typecheck after writing code. Fix all linting errors and type errors before considering the task complete. Zero tolerance for lint and typecheck errors | Critical |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Quality Guidelines
|
|
83
|
+
|
|
84
|
+
#### Avoid Over-Engineering
|
|
85
|
+
- **Rule:** Avoid over-engineering
|
|
86
|
+
- **Focus:** Focus on minimal viable solutions meeting acceptance criteria
|
|
87
|
+
- **Priority:** High
|
|
88
|
+
|
|
89
|
+
#### Testing Approach
|
|
90
|
+
- **Rule:** Only create automated tests if explicitly required
|
|
91
|
+
- **Priority:** Medium
|
|
92
|
+
|
|
93
|
+
#### Feature Scope
|
|
94
|
+
- **Rule:** Never add functionality "just in case"
|
|
95
|
+
- **Requirement:** Implement only what's needed now
|
|
96
|
+
- **Priority:** High
|
|
97
|
+
|
|
98
|
+
#### Code Validation
|
|
99
|
+
- **Rule:** Always run lint and typecheck after code changes
|
|
100
|
+
- **Requirement:** Must fix all linting and type checking errors before completion
|
|
101
|
+
- **Process:** Run lint command, then typecheck command. Address all errors and warnings
|
|
102
|
+
- **Tolerance:** Zero tolerance for lint or typecheck errors
|
|
103
|
+
- **Priority:** Critical
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Decision Making Framework
|
|
108
|
+
|
|
109
|
+
> **Description:** Apply these principles systematically for all decisions
|
|
110
|
+
> **Priority:** High
|
|
111
|
+
|
|
112
|
+
| Step | Principle | Importance |
|
|
113
|
+
|------|-----------|------------|
|
|
114
|
+
| 1 | Gather Complete Information | Critical |
|
|
115
|
+
| 2 | Multi-Perspective Analysis | High |
|
|
116
|
+
| 3 | Consider All Stakeholders | High |
|
|
117
|
+
| 4 | Evaluate Alternatives | High |
|
|
118
|
+
| 5 | Assess Impact & Consequences | High |
|
|
119
|
+
| 6 | Apply Ethical Framework | Medium |
|
|
120
|
+
| 7 | Take Responsibility | High |
|
|
121
|
+
| 8 | Learn & Adapt | High |
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Code Validation Workflow
|
|
126
|
+
|
|
127
|
+
> **Description:** Mandatory validation process after writing or modifying code
|
|
128
|
+
> **Priority:** Critical
|
|
129
|
+
|
|
130
|
+
#### Validation Commands
|
|
131
|
+
- **Lint Fix Command:** `yarn run lint-fix`
|
|
132
|
+
- **Type Check Command:** `yarn run type-check`
|
|
133
|
+
- **Combined Command:** `yarn run lint-fix && yarn run type-check`
|
|
134
|
+
|
|
135
|
+
#### Required Workflow
|
|
136
|
+
| Step | Action | Description |
|
|
137
|
+
|------|--------|-------------|
|
|
138
|
+
| 1 | Write/Edit Code | Make your code changes |
|
|
139
|
+
| 2 | Run Validation | Execute `yarn run lint-fix && yarn run type-check` |
|
|
140
|
+
| 3 | Review Results | Check for any remaining errors |
|
|
141
|
+
| 4 | Fix Errors | Address all lint and type errors |
|
|
142
|
+
| 5 | Repeat | Run validation again until all errors are resolved |
|
|
143
|
+
|
|
144
|
+
#### Rules
|
|
145
|
+
- **Rule:** Always run validation commands after every code change
|
|
146
|
+
- **Requirement:** Must run both lint-fix and type-check before considering task complete
|
|
147
|
+
- **Tolerance:** Zero errors allowed - all lint and type errors must be fixed
|
|
148
|
+
- **Priority:** Critical
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Package Manager
|
|
153
|
+
|
|
154
|
+
#### Required Package Manager
|
|
155
|
+
- **Rule:** Use `yarn` as the package manager for this project
|
|
156
|
+
- **Requirement:** All package installations and script executions must use `yarn`
|
|
157
|
+
- **Prohibited:** Do NOT use `npm`, `pnpm`, or `bun`
|
|
158
|
+
- **Priority:** Critical
|
|
159
|
+
|
|
160
|
+
#### Examples
|
|
161
|
+
| Action | Correct | Incorrect |
|
|
162
|
+
|--------|---------|-----------|
|
|
163
|
+
| Install dependencies | `yarn install` | `npm install`, `pnpm install` |
|
|
164
|
+
| Add package | `yarn add <package>` | `npm install <package>` |
|
|
165
|
+
| Run script | `yarn run <script>` | `npm run <script>` |
|
|
166
|
+
| Remove package | `yarn remove <package>` | `npm uninstall <package>` |
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
CAgent Embed is a JavaScript library for embedding a chatbot widget on websites. It connects to a CAgent (Flowise-based) backend and provides both popup and fullpage chat interfaces. The project also includes a proxy server for secure deployment.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Install dependencies
|
|
13
|
+
yarn install --frozen-lockfile
|
|
14
|
+
|
|
15
|
+
# Development (starts dev server on localhost:5678 with hot reload)
|
|
16
|
+
yarn dev
|
|
17
|
+
|
|
18
|
+
# Production build (outputs to dist/web.js)
|
|
19
|
+
yarn build
|
|
20
|
+
|
|
21
|
+
# Type checking
|
|
22
|
+
yarn type-check
|
|
23
|
+
|
|
24
|
+
# Linting
|
|
25
|
+
yarn lint
|
|
26
|
+
yarn lint-fix
|
|
27
|
+
|
|
28
|
+
# Start proxy server (for production deployment, runs on port 3001)
|
|
29
|
+
yarn start
|
|
30
|
+
|
|
31
|
+
# Build and publish to npm
|
|
32
|
+
yarn build-and-publish
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Architecture
|
|
36
|
+
|
|
37
|
+
### Entry Points
|
|
38
|
+
- `src/web.ts` - Main entry point, registers web components and exposes `Chatbot` API on window
|
|
39
|
+
- `src/register.tsx` - Registers custom elements `<cagent-chatbot>` (popup) and `<cagent-fullchatbot>` (fullpage)
|
|
40
|
+
- `src/window.ts` - Exposes `Chatbot.init()`, `Chatbot.initFull()`, and `Chatbot.destroy()` methods
|
|
41
|
+
|
|
42
|
+
### Core Components
|
|
43
|
+
- `src/components/Bot.tsx` - Main chat component handling messages, streaming, TTS/STT, file uploads, and all chat logic
|
|
44
|
+
- `src/features/bubble/components/Bubble.tsx` - Popup bubble UI wrapper
|
|
45
|
+
- `src/features/full/components/Full.tsx` - Fullpage chat UI wrapper
|
|
46
|
+
|
|
47
|
+
### Key Utilities
|
|
48
|
+
- `src/queries/sendMessageQuery.ts` - API communication with CAgent backend
|
|
49
|
+
- `src/utils/audioRecording.ts` - Audio recording for speech-to-text
|
|
50
|
+
- `src/utils/transcriptApi.ts` - Audio transcription API
|
|
51
|
+
- `src/utils/security.ts` - Security utilities
|
|
52
|
+
|
|
53
|
+
### Proxy Server
|
|
54
|
+
- `server.js` - Express proxy server that:
|
|
55
|
+
- Hides CAgent API host and chatflow IDs from client
|
|
56
|
+
- Implements domain-based access control
|
|
57
|
+
- Handles API key authentication server-side
|
|
58
|
+
- Requires `.env` configuration with `API_HOST`, `CAGENT_API_KEY`, and chatflow mappings
|
|
59
|
+
|
|
60
|
+
## Tech Stack
|
|
61
|
+
|
|
62
|
+
- **Framework**: SolidJS with solid-element for web components
|
|
63
|
+
- **Build**: Rollup with Babel, TypeScript, PostCSS/Tailwind
|
|
64
|
+
- **Styling**: Tailwind CSS (processed at build time, injected inline)
|
|
65
|
+
- **Streaming**: Microsoft fetch-event-source for SSE streaming responses
|
|
66
|
+
- **Path alias**: `@/*` maps to `src/*`
|
|
67
|
+
|
|
68
|
+
## Configuration
|
|
69
|
+
|
|
70
|
+
Environment variables (`.env`):
|
|
71
|
+
```
|
|
72
|
+
API_HOST=https://your-cagent-instance.com
|
|
73
|
+
CAGENT_API_KEY=your-api-key
|
|
74
|
+
chatflow_1=<chatflowId>,<allowedDomain1>,<allowedDomain2>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
For local development, update `public/index.html` to test the chatbot widget.
|