@rustic-ai/ui-components 1.0.1 → 1.0.3
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/dist/components/calendar/index.js +1 -1
- package/dist/components/codeSnippet/index.js +1 -1
- package/dist/components/dynamicForm/index.js +1 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/index.d.ts +1 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/map/index.js +1 -1
- package/dist/components/markdown/index.js +1 -1
- package/dist/components/markdown/markedMarkdown.d.ts.map +1 -1
- package/dist/components/media/audio/index.js +1 -1
- package/dist/components/media/video/index.js +1 -1
- package/dist/components/mockWebSocket.d.ts +1 -3
- package/dist/components/mockWebSocket.d.ts.map +1 -1
- package/dist/components/multipart/chatCompletion/index.js +1 -1
- package/dist/components/multipart/multipart/index.js +1 -1
- package/dist/components/question/index.js +1 -1
- package/dist/components/table/index.js +1 -1
- package/dist/components/types.d.ts +2 -11
- package/dist/components/types.d.ts.map +1 -1
- package/dist/components/visualization/mermaidViz/index.js +1 -1
- package/dist/components/visualization/perspectiveViz/index.js +1 -1
- package/dist/components/visualization/plotlyGraph/index.js +1 -1
- package/dist/components/visualization/vegaLiteViz/index.js +1 -1
- package/dist/components/visualization/vegaLiteViz/vegaLiteViz.d.ts.map +1 -1
- package/dist/components/weather/index.js +1 -1
- package/dist/index.css +0 -58
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/components/promptBuilder/index.css +0 -111
- package/dist/components/promptBuilder/index.d.ts +0 -5
- package/dist/components/promptBuilder/index.d.ts.map +0 -1
- package/dist/components/promptBuilder/index.js +0 -1
- package/dist/components/promptBuilder/promptBuilder.d.ts +0 -24
- package/dist/components/promptBuilder/promptBuilder.d.ts.map +0 -1
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
.rustic-prompt-builder {
|
|
2
|
-
padding: 24px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.rustic-prompt-builder-avatar {
|
|
6
|
-
width: 24px;
|
|
7
|
-
height: 24px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.rustic-prompt-builder-divider {
|
|
11
|
-
margin-top: 16px;
|
|
12
|
-
margin-bottom: 24px;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.rustic-prompt-builder-questions {
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
gap: 24px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.rustic-prompt-builder-question {
|
|
22
|
-
gap: 8px;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.rustic-prompt-builder-buttons {
|
|
26
|
-
display: flex;
|
|
27
|
-
justify-content: space-between;
|
|
28
|
-
margin-top: 56px;
|
|
29
|
-
gap: 16px;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.rustic-prompt-builder-buttons-left {
|
|
33
|
-
width: 100%;
|
|
34
|
-
display: flex;
|
|
35
|
-
gap: 8px;
|
|
36
|
-
justify-content: space-between;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.rustic-prompt-builder-dialog-buttons {
|
|
40
|
-
display: flex;
|
|
41
|
-
gap: 16px;
|
|
42
|
-
padding: 24px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@media (max-width: 900px) {
|
|
46
|
-
.rustic-prompt-builder-buttons-right button {
|
|
47
|
-
flex: 1;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.rustic-prompt-builder-buttons {
|
|
51
|
-
flex-direction: column;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.rustic-prompt-builder-buttons-right {
|
|
55
|
-
display: flex;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
body {
|
|
60
|
-
margin: 0;
|
|
61
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
62
|
-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
63
|
-
sans-serif;
|
|
64
|
-
-webkit-font-smoothing: antialiased;
|
|
65
|
-
-moz-osx-font-smoothing: grayscale;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
code {
|
|
69
|
-
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
|
70
|
-
monospace;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.rustic-fit-container {
|
|
74
|
-
object-fit: contain;
|
|
75
|
-
width: 100%;
|
|
76
|
-
height: 100%;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.rustic-files {
|
|
80
|
-
display: flex;
|
|
81
|
-
gap: 8px;
|
|
82
|
-
flex-wrap: wrap;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.rustic-cursor-pointer {
|
|
86
|
-
cursor: pointer;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.rustic-align-self-center {
|
|
90
|
-
align-self: center;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.rustic-shift-to-right-by-8 {
|
|
94
|
-
margin-right: -8px;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.rustic-participant-profile {
|
|
98
|
-
display: flex;
|
|
99
|
-
gap: 8px;
|
|
100
|
-
align-items: center;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.rustic-participant-profile .rustic-participant-avatar {
|
|
104
|
-
width: 16px;
|
|
105
|
-
height: 16px;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
span.rustic-icon-large {
|
|
109
|
-
font-size: 32px;
|
|
110
|
-
}
|
|
111
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/promptBuilder/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAE3C,cAAc,UAAU,CAAA;AACxB,eAAe,aAAa,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{MessageProcessStatus:()=>B,ParticipantRole:()=>T,ParticipantType:()=>D,UpdateType:()=>I,default:()=>_});const t=require("react/jsx-runtime"),n=require("@mui/material/Button");var i=e.n(n);const a=require("@mui/material/Card");var o=e.n(a);const s=require("@mui/material/CircularProgress");var l=e.n(s);const c=require("@mui/material/Dialog");var u=e.n(c);const d=require("@mui/material/DialogActions");var p=e.n(d);const m=require("@mui/material/DialogContent");var f=e.n(m);const g=require("@mui/material/DialogContentText");var h=e.n(g);const b=require("@mui/material/DialogTitle");var v=e.n(b);const y=require("@mui/material/Divider");var x=e.n(y);const j=require("@mui/material/Typography");var q=e.n(j);const w=require("@mui/system"),C=require("react");var O=e.n(C),P=function(){return P=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},P.apply(this,arguments)};const N=function(e){var r=e.messages[0],n=e.messages.slice(1),i=r.format;i.startsWith("update")&&(i=i.replace("update",""));var a=e.supportedElements[i];return(0,t.jsx)(t.Fragment,{children:a?O().createElement(a,P(P({sender:e.sender,ws:e.ws,messageId:r.id,conversationId:r.conversationId},r.data),n.length>0&&{updatedData:n.map(function(e){return e.data})})):(0,t.jsxs)(q(),{variant:"body2",children:["Unsupported element format: ",i]})})};var S=function(){return S=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},S.apply(this,arguments)};function A(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:S({},r),children:e.name})}var B,I,T,D,E=function(){return E=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},E.apply(this,arguments)},M=function(e,r,t){if(t||2===arguments.length)for(var n,i=0,a=r.length;i<a;i++)!n&&i in r||(n||(n=Array.prototype.slice.call(r,0,i)),n[i]=r[i]);return e.concat(n||Array.prototype.slice.call(r))};!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(B||(B={})),function(e){e.Append="append",e.Replace="replace"}(I||(I={})),function(e){e.Owner="owner",e.Member="member"}(T||(T={})),function(e){e.Human="human",e.Agent="agent"}(D||(D={}));const _=function(e){var r=(0,C.useState)(!1),n=r[0],a=r[1],s=(0,C.useState)(!1),c=s[0],d=s[1],m=(0,C.useState)(!1),g=m[0],b=m[1],y=(0,C.useState)(!1),j=y[0],O=y[1],P=(0,C.useState)([]),S=P[0],B=P[1],I=(0,C.useState)(null),T=I[0],D=I[1],_=(0,w.useTheme)(),k=S[S.length-1],R=E(E({},e.ws),{send:function(e){D(e)}});function Q(e){B(function(r){return M(M([],r,!0),[e],!1)})}function F(){if(T){var r=E(E({},T),{threadId:e.messageId});e.ws.send(r)}}if((0,C.useEffect)(function(){e.ws.onReceive&&e.ws.onReceive(Q)},[e.ws]),(0,C.useEffect)(function(){S.length>0&&(k&&k.sender.id!==e.sender.id&&d(!1),"promptBuilder"===k.format&&k.data.isLastQuestion&&a(!0))},[S.length]),0!==S.length)return(0,t.jsxs)(o(),{variant:"outlined",className:"rustic-prompt-builder",children:[(0,t.jsxs)(u(),{open:g,onClose:function(){return b(!1)},"aria-labelledby":"quit-dialog-title","aria-describedby":"quit-dialog-description",sx:{"& .MuiPaper-root":{width:"clamp(320px,50vw,600px)",border:"1px solid ".concat(_.palette.divider)}},children:[(0,t.jsx)(v(),{id:"quit-dialog-title",className:"rustic-align-self-center",children:"Are you sure?"}),(0,t.jsx)(x(),{}),(0,t.jsx)(f(),{children:(0,t.jsx)(h(),{id:"quit-dialog-description",className:"rustic-align-self-center",children:"All progress will be lost."})}),(0,t.jsxs)(p(),{className:"rustic-prompt-builder-dialog-buttons",disableSpacing:!0,children:[(0,t.jsx)(i(),{variant:"outlined",color:"secondary",startIcon:(0,t.jsx)(A,{name:"close"}),onClick:function(){b(!1),e.onCancel()},children:"Quit"}),(0,t.jsx)(i(),{variant:"contained",color:"primary",onClick:function(){return b(!1)},children:"Continue build"})]})]}),e.getProfileComponent?e.getProfileComponent(S[0]):(0,t.jsx)(q(),{color:"text.secondary",children:"Prompt Builder"}),(0,t.jsx)(x(),{className:"rustic-prompt-builder-divider"}),(0,t.jsxs)(w.Box,{className:"rustic-prompt-builder-questions",children:[function(){if(!j&&S.length>0)return S.map(function(r){if(r.sender.id!==e.sender.id&&"promptBuilder"!==r.format)return(0,t.jsx)(N,{ws:R,sender:e.sender,messages:[r],supportedElements:e.supportedElements},r.id)})}(),c&&(0,t.jsx)(l(),{color:"secondary",className:"rustic-align-self-center"})]}),(0,t.jsx)(t.Fragment,{children:!j&&(0,t.jsxs)(w.Box,{className:"rustic-prompt-builder-buttons",children:[(0,t.jsxs)(w.Box,{className:"rustic-prompt-builder-buttons-left",children:[(0,t.jsx)(i(),{variant:"outlined",color:"secondary",startIcon:(0,t.jsx)(A,{name:"close"}),onClick:function(){return b(!0)},children:"Quit"}),(0,t.jsx)(i(),{variant:"outlined",color:"secondary",endIcon:(0,t.jsx)(A,{name:"chevron_right"}),onClick:function(){F(),D(null),d(!0)},disabled:!T,"aria-disabled":!T,children:"Next question"})]}),n&&(0,t.jsx)(w.Box,{className:"rustic-prompt-builder-buttons-right",children:(0,t.jsx)(i(),{variant:"contained",color:"primary",onClick:function(){F(),O(!0),d(!0),e.onSubmit()},disabled:c,"aria-disabled":c,children:"Generate"})})]})})]})};return r})());
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import './promptBuilder.css';
|
|
2
|
-
import '../../index.css';
|
|
3
|
-
import type { PromptBuilderProps } from '../types';
|
|
4
|
-
/**
|
|
5
|
-
The `PromptBuilder` component is an interactive tool designed to help end users construct enhanced prompts through guided conversations with an agent. Users should be able to invoke the PromptBuilder via a button click or a text input command. Once activated, the agent guides the user step-by-step to create a detailed prompt, culminating in a "Generate" button for finalization or a "Next Question" option for further refinement.
|
|
6
|
-
|
|
7
|
-
The expected output of the `PromptBuilder` should not be direct answers to the gathered input. Instead, when the "Generate" button is clicked, the component should produce refined prompt suggestion(s) based on the user's responses during the guided conversation. The `PromptBuilder` does not display the results directly; instead, developers can use the `onSubmit` function to handle the output and choose the most appropriate place to present it within their application.
|
|
8
|
-
|
|
9
|
-
Try out the chat application example below to see how the `PromptBuilder` component can be used in your own application. Please note that the questions asked by agent are fixed as there is no backend involved. This is showcasing an example flow and use case.
|
|
10
|
-
|
|
11
|
-
Notes for implementation:
|
|
12
|
-
- The user will be allowed to start generating prompts when a message has been received with format of `"promptBuilder"` and data field of `isLastQuestion` set to `true`. For example:
|
|
13
|
-
```
|
|
14
|
-
const newMessage = {
|
|
15
|
-
...otherRequiredFields,
|
|
16
|
-
format: 'promptBuilder',
|
|
17
|
-
data: {
|
|
18
|
-
isLastQuestion: true
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
*/
|
|
23
|
-
export default function PromptBuilder(props: PromptBuilderProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
24
|
-
//# sourceMappingURL=promptBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promptBuilder.d.ts","sourceRoot":"","sources":["../../../src/components/promptBuilder/promptBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,iBAAiB,CAAA;AAiBxB,OAAO,KAAK,EAAW,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE3D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,kBAAkB,uDA0P9D"}
|