@worktango/ai-assistant 0.0.1 → 0.0.2-beta-gd2
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/README.md +107 -6
- package/backendTypes.ts +268 -0
- package/build/constants.js +80 -0
- package/build/dist/express.d.ts +2 -0
- package/build/dist/express.js +10457 -0
- package/build/express.d.ts +2 -0
- package/build/express.js +21 -0
- package/build/react.d.ts +4 -0
- package/build/react.js +44 -0
- package/build/src/backend/express.d.ts +63 -0
- package/build/src/backend/express.js +366 -0
- package/constants.js +80 -0
- package/dist/Absenteeism-DnYRfCGD.mjs +49 -0
- package/dist/ActivityFeed-CMR7d8a9.mjs +41 -0
- package/dist/AddUser-BxN71Gq-.mjs +128 -0
- package/dist/Admin-BNwEEcul.mjs +55 -0
- package/dist/Admin-CCOxh4NQ.mjs +70 -0
- package/dist/AiGeneral-6P2eop9s.mjs +43 -0
- package/dist/AiScoring-Be2EIJC_.mjs +67 -0
- package/dist/AiText-D4UwoEoT.mjs +67 -0
- package/dist/Anniversary-B3ZoAqa5.mjs +35 -0
- package/dist/Appreciation-B_rgIegc.mjs +55 -0
- package/dist/ArrowDown-CWFXlxhX.mjs +38 -0
- package/dist/ArrowLeft-D7rl_Ecd.mjs +12 -0
- package/dist/ArrowRight-BPLLV4yW.mjs +12 -0
- package/dist/ArrowUp-DYWuwxJM.mjs +31 -0
- package/dist/Attachment-CR6plcc5.mjs +20 -0
- package/dist/BeQuickDontHurry-BPnXAKBa.mjs +94 -0
- package/dist/Birthday-BihgKHOQ.mjs +66 -0
- package/dist/BrandPromise-fU0oR23R.mjs +57 -0
- package/dist/BrandVision-B37SFqTc.mjs +96 -0
- package/dist/Calendar-BdAku_za.mjs +24 -0
- package/dist/CaretDn-De_oYPN-.mjs +11 -0
- package/dist/CaretDown-DnGml5_x.mjs +5 -0
- package/dist/CaretLeft-D0BOxHEC.mjs +11 -0
- package/dist/CaretRight-dCjBT9bB.mjs +11 -0
- package/dist/CaretUp-BCw0fqJn.mjs +11 -0
- package/dist/ChallengeAccepted-CNaeHk1I.mjs +49 -0
- package/dist/CheckIn-CwG42QYQ.mjs +34 -0
- package/dist/CheckIns-A1Kkc_2W.mjs +33 -0
- package/dist/CheckSeal-Dqw_lc0S.mjs +31 -0
- package/dist/Checkmark-BHE91v8D.mjs +16 -0
- package/dist/Clock-CuAJQmxQ.mjs +33 -0
- package/dist/Close-D-f_iwQ8.mjs +12 -0
- package/dist/CloudDownload-CfQ7V21B.mjs +40 -0
- package/dist/Comment-GrrKaBsi.mjs +167 -0
- package/dist/Comments-YOn2eJUt.mjs +48 -0
- package/dist/Connections-CPlNaCbu.mjs +49 -0
- package/dist/Copy-NDpa2_F3.mjs +72 -0
- package/dist/CustomQuestion-OzfWoJV3.mjs +40 -0
- package/dist/CustomerSuccess-DAH7mRDK.mjs +50 -0
- package/dist/DatePicker-BxfSRn5x.mjs +303 -0
- package/dist/Dot-DCoU7aD3.mjs +12 -0
- package/dist/Download-DpF3elMl.mjs +38 -0
- package/dist/Drag-DWbGJvhn.mjs +41 -0
- package/dist/DragIndicator-CnDCSf3A.mjs +12 -0
- package/dist/Earn-7uXfIfZU.mjs +15 -0
- package/dist/Email-zAMtQLoS.mjs +24 -0
- package/dist/EmojiDisplay-DSZOjKek.mjs +38975 -0
- package/dist/EmojiPicker-DgtE9CiW.mjs +29560 -0
- package/dist/EnpsSurvey-Y9at0I5m.mjs +49 -0
- package/dist/Expired-BNR7WTVX.mjs +33 -0
- package/dist/Eye-DzoufmcZ.mjs +27 -0
- package/dist/Feedback-D7sxcXQ1.mjs +41 -0
- package/dist/Feedback-JZEpzb79.mjs +49 -0
- package/dist/Filter-C1JuLCfg.mjs +64 -0
- package/dist/Flag-C4l9OPVK.mjs +35 -0
- package/dist/Giphy-Bhmd8ypI.mjs +22 -0
- package/dist/GoalCount-CDtW2B-F.mjs +10 -0
- package/dist/GoalPercent-CEIqOHFH.mjs +21 -0
- package/dist/GoalTask-BRQInXIl.mjs +20 -0
- package/dist/GoalTask-Bhh_sX7J.mjs +42 -0
- package/dist/Goals-BMFrqSmc.mjs +79 -0
- package/dist/Goals-CPiQ13bO.mjs +70 -0
- package/dist/Growth-Ck1OiXeO.mjs +85 -0
- package/dist/Hamburger-BkqfmMmA.mjs +9 -0
- package/dist/Help-B2KqPPam.mjs +36 -0
- package/dist/HighFive-BYcQw328.mjs +33 -0
- package/dist/HighFive-Bi71jYQj.mjs +38 -0
- package/dist/Home-CHOKwBnN.mjs +21 -0
- package/dist/Home-DPyqkkoX.mjs +31 -0
- package/dist/HorizontalLine-DzBF5cf2.mjs +17 -0
- package/dist/Hourglass-sPcwiWfl.mjs +53 -0
- package/dist/Image-D-LHXhOl.mjs +41 -0
- package/dist/ImageFile-By-HPKcE.mjs +60 -0
- package/dist/InGoodCompany-CvfwTAMs.mjs +33 -0
- package/dist/Incentives-DnZQM_QS.mjs +155 -0
- package/dist/Info-CQnSKd8J.mjs +31 -0
- package/dist/Insights-BApP3QUO.mjs +20 -0
- package/dist/Insights-BivxsIhR.mjs +41 -0
- package/dist/Integrations-DUqcLKml.mjs +33 -0
- package/dist/KazooLogo-BVRhaQ-1.mjs +38 -0
- package/dist/KnowYourAudience-jvdpa8Co.mjs +91 -0
- package/dist/Launch-C5QbSdJn.mjs +83 -0
- package/dist/Link-CzMOWVHw.mjs +43 -0
- package/dist/LinkArrow-D7My064p.mjs +12 -0
- package/dist/Loading-C5wJAaZ-.mjs +6 -0
- package/dist/Lock-CrpqckDI.mjs +31 -0
- package/dist/Management-CfJCyzy8.mjs +87 -0
- package/dist/MeatballMenu-1RqUBn4Y.mjs +9 -0
- package/dist/MediaError-9_d5oB_T.mjs +40 -0
- package/dist/Messages-4waJxvel.mjs +221 -0
- package/dist/Microphone-8fk2NyjC.mjs +63 -0
- package/dist/Mobile-B7UDVCjR.mjs +31 -0
- package/dist/Nomination-DyVMjiwX.mjs +12 -0
- package/dist/NominationsAndAwards-DV8lxdIs.mjs +57 -0
- package/dist/Notification-DgAbq7ar.mjs +28 -0
- package/dist/Okrs-B5p8LEMY.mjs +55 -0
- package/dist/Pause-B7pDb0Ur.mjs +12 -0
- package/dist/PeerToPeer-EFRm2-Ns.mjs +64 -0
- package/dist/Pencil-6UZn-x0W.mjs +25 -0
- package/dist/People-DOYJOgS0.mjs +43 -0
- package/dist/PerformanceManagement-DavgifML.mjs +57 -0
- package/dist/Pin-C0KIHJ16.mjs +24 -0
- package/dist/PinnedIconAward-DUe5bm5u.mjs +20 -0
- package/dist/PinnedIconBrightIdea-BNdCStK9.mjs +20 -0
- package/dist/PinnedIconBullseye-DD7dZCoQ.mjs +36 -0
- package/dist/PinnedIconChampagne-HIJE7Yf3.mjs +20 -0
- package/dist/PinnedIconCheer-Pmd1imX0.mjs +20 -0
- package/dist/PinnedIconCrown-CPwPqzC4.mjs +20 -0
- package/dist/PinnedIconDiamond-D00JW81W.mjs +20 -0
- package/dist/PinnedIconHoleInOne-D6jh0Ane.mjs +20 -0
- package/dist/PinnedIconMedal-CEc_ezUs.mjs +20 -0
- package/dist/PinnedIconMetrics-CDU1uqhK.mjs +20 -0
- package/dist/PinnedIconPin-CSCDM0mw.mjs +20 -0
- package/dist/PinnedIconRockAndRoll-CQxSgO5d.mjs +23 -0
- package/dist/PinnedIconRocket-B1tXrzTg.mjs +20 -0
- package/dist/PinnedIconStrength-CVyMBzjV.mjs +20 -0
- package/dist/PinnedIconTeddyBear-C1YYmDoh.mjs +20 -0
- package/dist/PlatformLogo-0AOI2Cr9.mjs +57 -0
- package/dist/Plus-Dgh_a2E8.mjs +19 -0
- package/dist/Popper-DAaZXie8.mjs +1118 -0
- package/dist/PrivateEye-BUgV7GQk.mjs +127 -0
- package/dist/PrivatePushPin-C4ph6ZhF.mjs +33 -0
- package/dist/Processing-DOgV5nVT.mjs +80 -0
- package/dist/Productivity-BZuPAu6h.mjs +41 -0
- package/dist/ProgressCircle-C1bIKxWu.mjs +12 -0
- package/dist/PulseSurvey-YW8pgO3g.mjs +48 -0
- package/dist/PushPin-C0Vt7Qgz.mjs +18 -0
- package/dist/QuotesLeft-BrcaBZPo.mjs +18 -0
- package/dist/QuotesRight-VYMthud9.mjs +18 -0
- package/dist/Recognition-BLb29jsR.mjs +38 -0
- package/dist/Recognition-BlojPoTY.mjs +76 -0
- package/dist/Retention-D04eGyj2.mjs +47 -0
- package/dist/Rewards-BQ_4-Xnm.mjs +67 -0
- package/dist/Rewards-Cbm9UlJN.mjs +54 -0
- package/dist/RewardsCatalog-6bMpoD6s.mjs +49 -0
- package/dist/Roadmap-DK7G7m1M.mjs +122 -0
- package/dist/Search-BL5oOF1V.mjs +14 -0
- package/dist/Security-C7DgqkmM.mjs +33 -0
- package/dist/SendRecognition-CXWoOD5B.mjs +5 -0
- package/dist/ShareLink-DsdD7S2M.mjs +27 -0
- package/dist/SidebarCollapse-BycFfuBy.mjs +48 -0
- package/dist/Skill-C9DRN5_x.mjs +23 -0
- package/dist/Skills-Bf7uNero.mjs +68 -0
- package/dist/Smiley-C0W0nvQw.mjs +84 -0
- package/dist/Stop-B6-Rv84N.mjs +178 -0
- package/dist/Survey-B1ICwGfc.mjs +59 -0
- package/dist/Surveys-BygAscLB.mjs +54 -0
- package/dist/SyncUps-DNmrE_No.mjs +30 -0
- package/dist/Syncs-BCJtdDyW.mjs +29 -0
- package/dist/TalentReview-Bsf5rU5C.mjs +88 -0
- package/dist/TalentReview-Du4M8y3m.mjs +33 -0
- package/dist/TalentReviewInsights-p0rYC_2I.mjs +100 -0
- package/dist/TaskCompleted-DhURRWUZ.mjs +97 -0
- package/dist/Team-Rs8iU_vt.mjs +63 -0
- package/dist/Teams-BrkkrHW9.mjs +80 -0
- package/dist/TextBold-CgZBuifH.mjs +71 -0
- package/dist/TextBulletList-B6e_IEP-.mjs +128 -0
- package/dist/TextInput-B8AOwiHn.mjs +121 -0
- package/dist/TextItalic-C9jJChss.mjs +71 -0
- package/dist/TextNumberList-BfahObnv.mjs +147 -0
- package/dist/TextUnderline-n9b1v8UJ.mjs +90 -0
- package/dist/ThumbsDown-ZkPlc2MC.mjs +46 -0
- package/dist/ThumbsUp-C5EEURtj.mjs +46 -0
- package/dist/Toggle-CZuD0uCq.mjs +76 -0
- package/dist/Translate-DcOpGRTB.mjs +98 -0
- package/dist/Trash-CRdG3IYb.mjs +44 -0
- package/dist/TrendDown-CB3cl_u7.mjs +5 -0
- package/dist/TrendUp-D_f6etsq.mjs +5 -0
- package/dist/Undo-BfRfs2YI.mjs +41 -0
- package/dist/Unplugged-qrnvAmIJ.mjs +201 -0
- package/dist/UpDownCaret-CdoiwMWU.mjs +12 -0
- package/dist/VerifiedCheckmark-2saHRxh6.mjs +20 -0
- package/dist/VerticalLine-XjlxBP9Z.mjs +50 -0
- package/dist/Warning-B8864P6W.mjs +37 -0
- package/dist/WarningNoOutline-llm3ebvI.mjs +41 -0
- package/dist/YesAnd-DLEvdXw9.mjs +31 -0
- package/dist/ai-assistant.css +1 -0
- package/dist/emoji-CJuSGYZk.mjs +2310 -0
- package/dist/express.js +10936 -0
- package/dist/html2canvas.esm-DgdJBc_o.mjs +4871 -0
- package/dist/index-BEKNcH9V.mjs +721 -0
- package/dist/react-apexcharts.min-DLm6NZyI.mjs +11326 -0
- package/dist/react.es.js +15 -0
- package/dist/react.umd.js +1691 -0
- package/dist/reactComponent-CGfCiP84.mjs +44091 -0
- package/express.d.ts +88 -1
- package/express.js +4 -1
- package/generated/apiHooks.tsx +5644 -0
- package/generated/sdk.ts +5119 -0
- package/generated/stitchedSdk.ts +1174 -0
- package/package.json +46 -21
- package/react.d.ts +215 -0
- package/react.js +4 -1
- package/sharedTypes.ts +386 -0
package/README.md
CHANGED
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
A React component for embedding the WorkTango AI Assistant in your web application.
|
|
4
4
|
|
|
5
5
|
In scope:
|
|
6
|
+
- Voice to text, text to voice, and text-only chat interfaces
|
|
6
7
|
- Single-stream back-and-forth UI between an LLM and a user, similar to popular LLM AI assistant UIs
|
|
7
|
-
- Standardized API for
|
|
8
|
+
- Standardized API for consumers to hook into the chat and provide new guidance for the session, add instructions, contextual information, and other things to make the assistant more useful, or tailored to a specific feature or user
|
|
8
9
|
- Standardized API for tool calls, with multiple layers of fulfillment (e.g., client fulfilled; sourceServerFulfilled; proxyServerFulfilled)
|
|
9
10
|
- Consistent styling across WorkTango apps
|
|
10
11
|
- Embeddable in any React application
|
|
11
12
|
- Consistent with our other React components
|
|
12
13
|
|
|
13
14
|
Out of scope (for now):
|
|
14
|
-
-
|
|
15
|
+
- Chat session history management
|
|
15
16
|
- User authentication (we provide a server-to-server proxy middleware for that; this should only work for logged-in users)
|
|
17
|
+
- Unauthenticated users and LLM sessions (low chance we will ever even need this)
|
|
16
18
|
- Anything else not explicitly mentioned in the scope section, above
|
|
17
19
|
|
|
18
20
|
## Installation
|
|
@@ -25,20 +27,119 @@ yarn add @worktango/ai-assistant
|
|
|
25
27
|
|
|
26
28
|
## Usage
|
|
27
29
|
|
|
30
|
+
### Code generation
|
|
31
|
+
|
|
32
|
+
Our normal code generation can be used in this API, but with one caveat: this package may not use the normal GraphQL hooks when fulfilling tool calls. (You may still use hooks to do other operations, like upload metadata, chat history, etc.) Instead, use the `packages/ai-assistant/src/frontend/tools/generatedSdks.ts` map to access our strongly-typed SDKs.
|
|
33
|
+
|
|
34
|
+
For more information on code generation, see the [GraphQL README](../graphql/README.md).
|
|
35
|
+
|
|
36
|
+
In short:
|
|
37
|
+
|
|
38
|
+
1. Add the package you want to query to `dependencies` in this package
|
|
39
|
+
2. Write the appropriate query in this package's `queries` directory
|
|
40
|
+
3. Run `yarn generate:gql`.
|
|
41
|
+
|
|
42
|
+
Your generated code will be in `packages/ai-assistant/generated`.
|
|
43
|
+
|
|
44
|
+
Also note that _we commit generated files_, since they are path agnostic and have saved hundreds of hours of build times over the years.
|
|
45
|
+
|
|
28
46
|
### React Applications
|
|
29
47
|
|
|
30
48
|
```jsx
|
|
31
49
|
import { AiAssistant } from "@worktango/ai-assistant/react";
|
|
50
|
+
import "@worktango/ai-assistant/dist/ai-assistant.css";
|
|
32
51
|
|
|
33
52
|
function App() {
|
|
53
|
+
return (<AiAssistant />);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Note:** You must import the CSS file to ensure components are styled correctly. This includes components like `GenAIRatingComponentApolloWrapped`.
|
|
58
|
+
|
|
59
|
+
### Using GenAIRatingComponentApolloWrapped
|
|
60
|
+
|
|
61
|
+
The `GenAIRatingComponentApolloWrapped` component allows users to rate AI-generated content (e.g., survey summaries, comments summaries). It can be used outside the AI Assistant context.
|
|
62
|
+
|
|
63
|
+
**Important:** You must configure the bearer token strategy before using this component. This is typically done once at your app's initialization:
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import { config } from "@worktango/ai-assistant/react";
|
|
67
|
+
import { getAccessToken } from './your-auth-module';
|
|
68
|
+
|
|
69
|
+
// In your root component or app initialization
|
|
70
|
+
React.useEffect(() => {
|
|
71
|
+
config.setPulseBearerTokenStrategy(() => getAccessToken() ?? '');
|
|
72
|
+
}, []);
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Once configured, you can use the component anywhere in your app:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import { GenAIRatingComponentApolloWrapped } from "@worktango/ai-assistant/react";
|
|
79
|
+
import "@worktango/ai-assistant/dist/ai-assistant.css";
|
|
80
|
+
|
|
81
|
+
function MyComponent() {
|
|
34
82
|
return (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
83
|
+
<GenAIRatingComponentApolloWrapped
|
|
84
|
+
responseType="SURVEY_SUMMARY"
|
|
85
|
+
responseId="123"
|
|
86
|
+
genAiMessage="This is the AI-generated summary..."
|
|
87
|
+
genAiMessageTimestamp="2026-01-28T12:00:00Z"
|
|
88
|
+
aiResponseRating={existingRating} // Optional: existing rating data
|
|
89
|
+
/>
|
|
38
90
|
);
|
|
39
91
|
}
|
|
40
92
|
```
|
|
41
93
|
|
|
94
|
+
## Testing
|
|
95
|
+
|
|
96
|
+
To test whether a change might break the build when this application is deployed on another server, you can test it in this repository in the following ways:
|
|
97
|
+
|
|
98
|
+
**Testing just the UI**
|
|
99
|
+
|
|
100
|
+
If you just made UI changes, you can rename `packages/ai-assistant/react.ts` to `_react.ts`; and `react.public.js` to `react.js`. Then, run `yarn build:all` in this package. Once you do that, when you restart the development server, webpack will use the `react.js` file to load the component over at `/admin/ai-assistant`, and use the fully bundled React component to do so.
|
|
101
|
+
|
|
102
|
+
**Testing locally with pulse-web**
|
|
103
|
+
|
|
104
|
+
To test changes in pulse-web before publishing to npm, use `yarn link`:
|
|
105
|
+
|
|
106
|
+
1. **Register the package for linking in kazoo-web:**
|
|
107
|
+
```bash
|
|
108
|
+
cd /path/to/kazoo-web/packages/ai-assistant
|
|
109
|
+
yarn link
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
This registers `@worktango/ai-assistant` globally for linking.
|
|
113
|
+
|
|
114
|
+
2. **Link the package in pulse-web:**
|
|
115
|
+
```bash
|
|
116
|
+
cd /path/to/pulse-web
|
|
117
|
+
yarn link @worktango/ai-assistant
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
This creates a symlink from pulse-web's `node_modules` to your local kazoo-web package.
|
|
121
|
+
|
|
122
|
+
3. **Build the package after making changes:**
|
|
123
|
+
|
|
124
|
+
After any code changes in kazoo-web:
|
|
125
|
+
```bash
|
|
126
|
+
cd /path/to/kazoo-web/packages/ai-assistant
|
|
127
|
+
yarn build:all
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Restart your pulse-web dev server to pick up the changes.
|
|
131
|
+
|
|
132
|
+
4. **When done testing:**
|
|
133
|
+
|
|
134
|
+
Unlink the package in pulse-web:
|
|
135
|
+
```bash
|
|
136
|
+
cd /path/to/pulse-web
|
|
137
|
+
yarn unlink @worktango/ai-assistant
|
|
138
|
+
yarn install --force
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
This removes the symlink and reinstalls the published version from npm.
|
|
142
|
+
|
|
42
143
|
## Features
|
|
43
144
|
|
|
44
|
-
|
|
145
|
+
- Unified tool call API for all WorkTango apps
|
package/backendTypes.ts
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
// Don't import from the generated folder, as it is removed when we build and publish the package.
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
AppendMessageInput,
|
|
5
|
+
AppendMessageToConversationMutation,
|
|
6
|
+
ConversationInput,
|
|
7
|
+
CreateConversationInput,
|
|
8
|
+
DeleteConversationInput,
|
|
9
|
+
UpdateConversationTitleInput,
|
|
10
|
+
GetAConversationQuery,
|
|
11
|
+
GetAllConversationsQuery,
|
|
12
|
+
DeleteAiDocumentMutation,
|
|
13
|
+
UpdateAiDocumentMutation,
|
|
14
|
+
UploadAiDocumentMutation,
|
|
15
|
+
UpdateAiSettingsMutation,
|
|
16
|
+
GetAiSettingsQuery,
|
|
17
|
+
} from "./generated/apiHooks";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Context passed to callbacks containing both request and response data
|
|
21
|
+
*/
|
|
22
|
+
export interface CallbackContext<TRequest, TResponse> {
|
|
23
|
+
/**
|
|
24
|
+
* The original request details
|
|
25
|
+
*/
|
|
26
|
+
request: {
|
|
27
|
+
/**
|
|
28
|
+
* The full path of the request (e.g., "/ai-assistant?targetPath=/api")
|
|
29
|
+
*/
|
|
30
|
+
path: string;
|
|
31
|
+
/**
|
|
32
|
+
* The HTTP method (POST, GET, etc.)
|
|
33
|
+
*/
|
|
34
|
+
method: string;
|
|
35
|
+
/**
|
|
36
|
+
* The parsed request body
|
|
37
|
+
*/
|
|
38
|
+
body: TRequest;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The parsed response body from the proxied request
|
|
42
|
+
*/
|
|
43
|
+
response: TResponse;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* REST endpoint request/response types
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
export interface ChatRequest {
|
|
51
|
+
model?: "large" | "medium" | "small";
|
|
52
|
+
temperature?: number;
|
|
53
|
+
stream?: boolean;
|
|
54
|
+
maxTokens?: number;
|
|
55
|
+
messages: Array<{
|
|
56
|
+
role: "user" | "model" | "tool";
|
|
57
|
+
parts: Array<
|
|
58
|
+
| {
|
|
59
|
+
type: "text";
|
|
60
|
+
text: string;
|
|
61
|
+
}
|
|
62
|
+
| {
|
|
63
|
+
type: "toolCall";
|
|
64
|
+
toolName: string;
|
|
65
|
+
args: Record<string, unknown>;
|
|
66
|
+
}
|
|
67
|
+
| {
|
|
68
|
+
type: "toolResult";
|
|
69
|
+
toolName: string;
|
|
70
|
+
result: unknown;
|
|
71
|
+
}
|
|
72
|
+
>;
|
|
73
|
+
name?: string;
|
|
74
|
+
}>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface ChatResponse {
|
|
78
|
+
role: "user" | "model" | "tool";
|
|
79
|
+
parts: Array<
|
|
80
|
+
| {
|
|
81
|
+
type: "text";
|
|
82
|
+
text: string;
|
|
83
|
+
}
|
|
84
|
+
| {
|
|
85
|
+
type: "toolCall";
|
|
86
|
+
toolName: string;
|
|
87
|
+
args: Record<string, unknown>;
|
|
88
|
+
}
|
|
89
|
+
| {
|
|
90
|
+
type: "toolResult";
|
|
91
|
+
toolName: string;
|
|
92
|
+
result: unknown;
|
|
93
|
+
}
|
|
94
|
+
>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface StructuredResponseRequest {
|
|
98
|
+
model?: "large" | "medium" | "small";
|
|
99
|
+
prompt: string;
|
|
100
|
+
schema: unknown;
|
|
101
|
+
temperature?: number;
|
|
102
|
+
maxTokens?: number;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type StructuredResponseResponse = unknown;
|
|
106
|
+
|
|
107
|
+
export interface TTSRequest {
|
|
108
|
+
text: string;
|
|
109
|
+
voice?: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface TTSResponse {
|
|
113
|
+
synthesis: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface STTRequest {
|
|
117
|
+
audio: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface STTResponse {
|
|
121
|
+
transcription: Array<{
|
|
122
|
+
transcript: string;
|
|
123
|
+
confidence: number;
|
|
124
|
+
}>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* GraphQL request wrapper
|
|
129
|
+
*/
|
|
130
|
+
export interface GraphQLRequest<TVariables = unknown> {
|
|
131
|
+
operationName?: string;
|
|
132
|
+
query: string;
|
|
133
|
+
variables?: TVariables;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* GraphQL response wrapper with potential errors
|
|
138
|
+
*/
|
|
139
|
+
export interface GraphQLResponse<TData = unknown> {
|
|
140
|
+
data?: TData;
|
|
141
|
+
errors?: Array<{
|
|
142
|
+
message: string;
|
|
143
|
+
extensions?: Record<string, unknown>;
|
|
144
|
+
}>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Callbacks for REST endpoints
|
|
149
|
+
* Note: Keys are URL paths, not following camelCase convention intentionally
|
|
150
|
+
*/
|
|
151
|
+
export interface RestEndpointCallbacks {
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
153
|
+
"/api/api-ai-assistant/v1/chat"?: (
|
|
154
|
+
context: CallbackContext<ChatRequest, ChatResponse>
|
|
155
|
+
) => void | Promise<void>;
|
|
156
|
+
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
158
|
+
"/api/api-ai-assistant/v1/structured-response"?: (
|
|
159
|
+
context: CallbackContext<
|
|
160
|
+
StructuredResponseRequest,
|
|
161
|
+
StructuredResponseResponse
|
|
162
|
+
>
|
|
163
|
+
) => void | Promise<void>;
|
|
164
|
+
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
166
|
+
"/api/api-ai-assistant/v1/tts"?: (
|
|
167
|
+
context: CallbackContext<TTSRequest, TTSResponse>
|
|
168
|
+
) => void | Promise<void>;
|
|
169
|
+
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
171
|
+
"/api/api-ai-assistant/v1/stt"?: (
|
|
172
|
+
context: CallbackContext<STTRequest, STTResponse>
|
|
173
|
+
) => void | Promise<void>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Callbacks for GraphQL operations
|
|
178
|
+
* Note: Keys match the GraphQL operation names (PascalCase), not the field names
|
|
179
|
+
*/
|
|
180
|
+
export interface GraphQLOperationCallbacks {
|
|
181
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
182
|
+
AppendMessageToConversation?: (
|
|
183
|
+
context: CallbackContext<
|
|
184
|
+
GraphQLRequest<{ input: AppendMessageInput }>,
|
|
185
|
+
GraphQLResponse<AppendMessageToConversationMutation>
|
|
186
|
+
>
|
|
187
|
+
) => void | Promise<void>;
|
|
188
|
+
|
|
189
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
190
|
+
GetAConversation?: (
|
|
191
|
+
context: CallbackContext<
|
|
192
|
+
GraphQLRequest<{ input: ConversationInput }>,
|
|
193
|
+
GraphQLResponse<GetAConversationQuery>
|
|
194
|
+
>
|
|
195
|
+
) => void | Promise<void>;
|
|
196
|
+
|
|
197
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
198
|
+
GetAllConversations?: (
|
|
199
|
+
context: CallbackContext<
|
|
200
|
+
GraphQLRequest<Record<string, never>>,
|
|
201
|
+
GraphQLResponse<GetAllConversationsQuery>
|
|
202
|
+
>
|
|
203
|
+
) => void | Promise<void>;
|
|
204
|
+
|
|
205
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
206
|
+
CreateConversation?: (
|
|
207
|
+
context: CallbackContext<
|
|
208
|
+
GraphQLRequest<{ input: CreateConversationInput }>,
|
|
209
|
+
GraphQLResponse
|
|
210
|
+
>
|
|
211
|
+
) => void | Promise<void>;
|
|
212
|
+
|
|
213
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
214
|
+
DeleteConversation?: (
|
|
215
|
+
context: CallbackContext<
|
|
216
|
+
GraphQLRequest<{ input: DeleteConversationInput }>,
|
|
217
|
+
GraphQLResponse
|
|
218
|
+
>
|
|
219
|
+
) => void | Promise<void>;
|
|
220
|
+
|
|
221
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
222
|
+
UpdateConversationTitle?: (
|
|
223
|
+
context: CallbackContext<
|
|
224
|
+
GraphQLRequest<{ input: UpdateConversationTitleInput }>,
|
|
225
|
+
GraphQLResponse
|
|
226
|
+
>
|
|
227
|
+
) => void | Promise<void>;
|
|
228
|
+
|
|
229
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
230
|
+
DeleteAiDocument?: (
|
|
231
|
+
context: CallbackContext<
|
|
232
|
+
GraphQLRequest<unknown>,
|
|
233
|
+
GraphQLResponse<DeleteAiDocumentMutation>
|
|
234
|
+
>
|
|
235
|
+
) => void | Promise<void>;
|
|
236
|
+
|
|
237
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
238
|
+
UpdateAiDocument?: (
|
|
239
|
+
context: CallbackContext<
|
|
240
|
+
GraphQLRequest<unknown>,
|
|
241
|
+
GraphQLResponse<UpdateAiDocumentMutation>
|
|
242
|
+
>
|
|
243
|
+
) => void | Promise<void>;
|
|
244
|
+
|
|
245
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
246
|
+
UploadAiDocument?: (
|
|
247
|
+
context: CallbackContext<
|
|
248
|
+
GraphQLRequest<unknown>,
|
|
249
|
+
GraphQLResponse<UploadAiDocumentMutation>
|
|
250
|
+
>
|
|
251
|
+
) => void | Promise<void>;
|
|
252
|
+
|
|
253
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
254
|
+
UpdateAiSettings?: (
|
|
255
|
+
context: CallbackContext<
|
|
256
|
+
GraphQLRequest<unknown>,
|
|
257
|
+
GraphQLResponse<UpdateAiSettingsMutation>
|
|
258
|
+
>
|
|
259
|
+
) => void | Promise<void>;
|
|
260
|
+
|
|
261
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
262
|
+
GetAiSettings?: (
|
|
263
|
+
context: CallbackContext<
|
|
264
|
+
GraphQLRequest<Record<string, never>>,
|
|
265
|
+
GraphQLResponse<GetAiSettingsQuery>
|
|
266
|
+
>
|
|
267
|
+
) => void | Promise<void>;
|
|
268
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file contains constants for the WorkTango Coach AI Assistant. It should
|
|
4
|
+
* contain no imports or dependencies: just constants and JSDoc types.
|
|
5
|
+
*
|
|
6
|
+
* We use it for sharing prompts and other data between systems in as light a way
|
|
7
|
+
* as possible.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.workTangoCoachGlobalSuggestedPrompts = exports.workTangoCoachSystemInstruction = void 0;
|
|
11
|
+
exports.workTangoCoachSystemInstruction = `You are a 'Leadership Coach'. Your purpose is to empower People Leaders by providing guidance, resources, and tools to enhance their leadership capabilities. You will assist users in various aspects of leadership development, from problem-solving to goal setting and self-reflection. Sometimes you will be tasked with analyzing Survey Results. The Survey Results will inform the Coaching focus.
|
|
12
|
+
|
|
13
|
+
Purpose and Goals:
|
|
14
|
+
|
|
15
|
+
* **Guidance and Research:** Help users research and understand effective approaches to specific leadership challenges, issues, or topics.
|
|
16
|
+
* **Self-Assessment Support:** Assist users in conducting self-assessments to identify their strengths, weaknesses, and areas for development as leaders.
|
|
17
|
+
* **Goal Setting Facilitation:** Guide users through the process of setting clear, actionable, and measurable leadership goals.
|
|
18
|
+
* **Reflective Questioning:** Engage users in reflective exercises using 'Powerful Questions' to encourage introspection and deeper understanding of their leadership journey.
|
|
19
|
+
* **Knowledge Transfer:** Educate users on leadership theories, best practices, and effective strategies for leading teams and organizations.
|
|
20
|
+
|
|
21
|
+
Behaviors and Rules:
|
|
22
|
+
|
|
23
|
+
**Initial Engagement:**
|
|
24
|
+
- If asked about something specific, you can skip the formal introduction, otherwise:
|
|
25
|
+
- Greet the user warmly as their 'Leadership Coach' and express readiness to assist them in their growth as a Leader
|
|
26
|
+
- List common requests you're designed to handle (research, self-assessment, goal setting, reflection, teaching).
|
|
27
|
+
- Indicate that the session will be 5-10 mins
|
|
28
|
+
- Ask the user to specify which of these areas they'd like to focus on first, or if they have a different leadership challenge in mind.
|
|
29
|
+
|
|
30
|
+
**Interactive Support:**
|
|
31
|
+
|
|
32
|
+
- For research requests, ask clarifying questions to understand the specific challenge or topic, then provide concise, actionable insights or resources.
|
|
33
|
+
- For self-assessment, present frameworks or prompts, and encourage the user to share their thoughts, offering constructive feedback.
|
|
34
|
+
- For goal setting, help the user define SMART (Specific, - Measurable, Achievable, Relevant, Time-bound) goals, breaking them down into manageable steps.
|
|
35
|
+
- When using 'Powerful Questions', pose open-ended, thought-provoking questions that encourage deep reflection rather than simple 'yes/no' answers.
|
|
36
|
+
- When teaching, break down complex concepts into understandable segments, providing examples and real-world applications.
|
|
37
|
+
|
|
38
|
+
**Coaching Approach:**
|
|
39
|
+
|
|
40
|
+
- Aim for a 5-10 minute coaching session
|
|
41
|
+
- Maintain a supportive, encouraging, and non-judgmental demeanor.
|
|
42
|
+
- Propose paths forward and look for input on the relevance of what is being suggested
|
|
43
|
+
- Encourage active participation and critical thinking from the user.
|
|
44
|
+
- Keep responses concise and clear, generally within 2-3 sentences per turn, allowing for a dynamic conversation flow.
|
|
45
|
+
- Always end the conversation with a summary of the discussions and recommended actions for the People Leader
|
|
46
|
+
|
|
47
|
+
Overall Tone:
|
|
48
|
+
|
|
49
|
+
* **Empowering and Positive:** Foster a sense of capability and growth in the user.
|
|
50
|
+
* **Knowledgeable and Trustworthy:** Convey expertise in leadership principles and practices.
|
|
51
|
+
* **Patient and Understanding:** Recognize the complexities of leadership and support users through their challenges.
|
|
52
|
+
* **Action-Oriented:** Encourage practical application of learned concepts.
|
|
53
|
+
`;
|
|
54
|
+
/**
|
|
55
|
+
* @typedef {Object} AiAssistantSuggestedPrompt
|
|
56
|
+
* @property {string} title - The title of the suggested prompt.
|
|
57
|
+
* @property {string} [fullPrompt] - The full prompt to be used. If not provided, the title will be used as the prompt.
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* Globally-available suggested prompts used between platforms.
|
|
61
|
+
* @type {AiAssistantSuggestedPrompt[]}
|
|
62
|
+
*/
|
|
63
|
+
exports.workTangoCoachGlobalSuggestedPrompts = [
|
|
64
|
+
{
|
|
65
|
+
title: "Help me research how to approach a specific challenge, issue or topic",
|
|
66
|
+
},
|
|
67
|
+
{ title: "Help me set effective goals for my team" },
|
|
68
|
+
{ title: "Help me structure better 1-on-1s with my team" },
|
|
69
|
+
{ title: "Help me reflect with powerful questions" },
|
|
70
|
+
{ title: "Help me have a difficult conversation with a team member" },
|
|
71
|
+
{ title: "Help me delegate more effectively" },
|
|
72
|
+
{ title: "Help me with a self assessment" },
|
|
73
|
+
{
|
|
74
|
+
title: "How do I adapt my leadership approach to different personalities?",
|
|
75
|
+
},
|
|
76
|
+
{ title: "How do I keep my team motivated during a crunch period?" },
|
|
77
|
+
{ title: "How do I make space for strategic thinking amid daily fires?" },
|
|
78
|
+
{ title: "How can I communicate a tough change to my team with empathy?" },
|
|
79
|
+
];
|
|
80
|
+
//# sourceMappingURL=constants.js.map
|