@tachybase/plugin-ai-chat 0.23.49 → 1.0.6
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/client/index.js
CHANGED
|
@@ -387,4 +387,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
387
387
|
text-align: justify;
|
|
388
388
|
word-break: break-all;
|
|
389
389
|
`})),A1=()=>{const{insert:e}=U.useSchemaInitializer(),t=U.useSchemaInitializerItem();return A.jsx(U.SchemaInitializerItem,wn(j({},t),{icon:A.jsx(q.CommentOutlined,{}),onClick:()=>{e(L1)}}))},L1={type:"void","x-component":"CardItem","x-settings":"blockSettings:aichat",properties:{aiChatBlock:{"x-component":"AiChatBlock"}}},Hh=(e,t)=>A.jsxs(G.Space,{align:"start",children:[e,A.jsx("span",{children:t})]}),O1=()=>{const{styles:e}=N1(),t=U.useAPIClient(),[n,r]=C.useState(""),{t:o}=Os(),i=[{key:"1",label:Hh(A.jsx(q.FireOutlined,{style:{color:"#FF4D4F"}}),o("About Tachybase")),description:o("Guess you want"),children:[{key:"1-1",description:o("About Platform")},{key:"1-2",description:o("What Can We Do")}]},{key:"2",label:Hh(A.jsx(q.ReadOutlined,{style:{color:"#1890FF"}}),o("How To Start")),description:o("Guess you want"),children:[{key:"2-1",icon:A.jsx(q.HeartOutlined,{}),description:o("InformationForm")},{key:"2-2",icon:A.jsx(q.SmileOutlined,{}),description:o("LoginComponent")},{key:"2-3",icon:A.jsx(q.CommentOutlined,{}),description:o("DateComponent")}]}],l={ai:{placement:"start",typing:{step:5,interval:20},styles:{content:{borderRadius:16}}},local:{placement:"end",variant:"shadow"},system:{placement:"start",variant:"shadow",styles:{content:{width:"100%"}}}},[a]=jh({request:(h,c)=>It(this,[h,c],function*({message:x},{onSuccess:v,onError:k}){try{const g=(yield t.request({method:"post",url:"aichat:sendMessage",headers:{"Content-Type":"application/json"},data:{message:x}})).data.data.choices[0].message.content;v(g)}catch(p){k(p)}})}),u=x=>{x&&(s(x),r(""))},{onRequest:s,messages:f}=Oh({agent:a}),m=x=>{s(x.data.description)},d=A.jsx(G.Space,{direction:"vertical",size:20,className:e.placeholder,children:A.jsx(bl,{title:"Do you want?",items:i,styles:{list:{width:"100%"},item:{flex:1}},onItemClick:m})}),y=f.map(({id:x,message:v,status:k})=>({key:x,role:k==="local"?"local":"ai",content:v,messageRender:h=>{const c=h.split(`
|
|
390
|
-
`).map((p,g)=>A.jsxs("span",{children:[p,A.jsx("br",{})]},g));return A.jsx(A.Fragment,{children:c})}}));return A.jsxs("div",{className:e.chat,children:[A.jsx(zl.List,{items:y.length>0?y:[{content:d,variant:"borderless",role:"system"}],roles:l,className:e.messages}),A.jsx(Ns,{value:n,onSubmit:u,onChange:r,loading:a.isRequesting(),className:e.sender})]})},z1=()=>{const e=U.useAPIClient(),{data:t}=U.useRequest(()=>e.resource("aichat").get().then(r=>{var o;return(o=r.data)==null?void 0:o.data}));return{form:Te.createForm({values:t})}},b1=()=>{const e=Te.useForm(),{message:t}=G.App.useApp(),n=U.useAPIClient(),{t:r}=Ke.useTranslation();return{run(){return It(this,null,function*(){yield e.submit();const i=we.cloneDeep(e.values);try{yield n.request({url:"aichat:set",method:"post",data:i}),t.success(r("Saved successfully"))}catch(l){throw t.error(r("Failed to save settings")),l}})}}},R1={type:"object",properties:{aichatsetting:{"x-component":"FormV2","x-use-component-props":"useAISettingsValues",type:"void",title:'{{t("AIchat settings")}}',properties:{Model:{type:"string",title:"{{t('Model')}}","x-decorator":"FormItem","x-component":"Input"},AI_API_KEY:{type:"string",title:"{{t('API Key')}}","x-decorator":"FormItem","x-component":"Input"},AI_URL:{type:"string",title:"{{t('API URL')}}","x-decorator":"FormItem","x-component":"Input"},System_messages:{type:"string",title:"{{t('System Messages')}}","x-decorator":"FormItem","x-component":"Input.TextArea"},footer:{type:"void","x-component":"ActionBar",properties:{submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSaveAISettingsValues }}"}}}}}}}},j1=()=>A.jsx(G.Card,{bordered:!1,children:A.jsx(U.SchemaComponent,{schema:R1,scope:{useAISettingsValues:z1,useSaveAISettingsValues:b1}})}),D1=()=>{const{setOpen:e}=P1();return A.jsx(G.FloatButton,{icon:A.jsx(q.CommentOutlined,{}),onClick:()=>{e(!0)}})},$1=e=>A.jsx(U.PinnedPluginListProvider,{items:{ai:{order:330,component:"AIChatButton",pin:!0,isPublic:!0,belongTo:"hoverbutton"}},children:A.jsx(U.SchemaComponentOptions,{components:{AIChatButton:D1},children:e.children})});class Uh extends U.Plugin{load(){return It(this,null,function*(){this.app.use(T1),this.app.use($1),this.app.systemSettingsManager.add("system-services.ai-settings",{icon:"SettingOutlined",title:$h("AIchat settings"),Component:j1}),this.schemaSettingsManager.add(I1),this.app.addComponents({AiChatBlock:O1});const t=this.app.schemaInitializerManager.get("page:addBlock");t==null||t.add("otherBlocks.aiChatBlock",{title:$h("AIchat"),Component:A1})})}}D.PluginAiChatClient=Uh,D.default=Uh,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
390
|
+
`).map((p,g)=>A.jsxs("span",{children:[p,A.jsx("br",{})]},g));return A.jsx(A.Fragment,{children:c})}}));return A.jsxs("div",{className:e.chat,children:[A.jsx(zl.List,{items:y.length>0?y:[{content:d,variant:"borderless",role:"system"}],roles:l,className:e.messages}),A.jsx(Ns,{value:n,onSubmit:u,onChange:r,loading:a.isRequesting(),className:e.sender})]})},z1=()=>{const e=U.useAPIClient(),{data:t}=U.useRequest(()=>e.resource("aichat").get().then(r=>{var o;return(o=r.data)==null?void 0:o.data}));return{form:Te.createForm({values:t})}},b1=()=>{const e=Te.useForm(),{message:t}=G.App.useApp(),n=U.useAPIClient(),{t:r}=Ke.useTranslation();return{run(){return It(this,null,function*(){yield e.submit();const i=we.cloneDeep(e.values);try{yield n.request({url:"aichat:set",method:"post",data:i}),t.success(r("Saved successfully"))}catch(l){throw t.error(r("Failed to save settings")),l}})}}},R1={type:"object",properties:{aichatsetting:{"x-component":"FormV2","x-use-component-props":"useAISettingsValues",type:"void",title:'{{t("AIchat settings")}}',properties:{Model:{type:"string",title:"{{t('Model')}}","x-decorator":"FormItem","x-component":"Input"},AI_API_KEY:{type:"string",title:"{{t('API Key')}}","x-decorator":"FormItem","x-component":"Input"},AI_URL:{type:"string",title:"{{t('API URL')}}","x-decorator":"FormItem","x-component":"Input"},System_messages:{type:"string",title:"{{t('System Messages')}}","x-decorator":"FormItem","x-component":"Input.TextArea"},footer:{type:"void","x-component":"ActionBar",properties:{submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSaveAISettingsValues }}"}}}}}}}},j1=()=>A.jsx(G.Card,{bordered:!1,children:A.jsx(U.SchemaComponent,{schema:R1,scope:{useAISettingsValues:z1,useSaveAISettingsValues:b1}})}),D1=()=>{const{setOpen:e}=P1();return A.jsx(G.FloatButton,{icon:A.jsx(q.CommentOutlined,{}),onClick:()=>{e(!0)}})},$1=e=>A.jsx(U.PinnedPluginListProvider,{items:{ai:{order:330,component:"AIChatButton",pin:!0,isPublic:!0,belongTo:"hoverbutton"}},children:A.jsx(U.SchemaComponentOptions,{components:{AIChatButton:D1},children:e.children})});class Uh extends U.Plugin{load(){return It(this,null,function*(){this.app.use(T1),this.app.use($1),this.app.systemSettingsManager.add("system-services.ai-settings",{icon:"SettingOutlined",title:$h("AIchat settings"),Component:j1,aclSnippet:"pm.system-services.ai-settings"}),this.schemaSettingsManager.add(I1),this.app.addComponents({AiChatBlock:O1});const t=this.app.schemaInitializerManager.get("page:addBlock");t==null||t.add("otherBlocks.aiChatBlock",{title:$h("AIchat"),Component:A1})})}}D.PluginAiChatClient=Uh,D.default=Uh,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "0.
|
|
3
|
+
"@tachybase/client": "1.0.6",
|
|
4
4
|
"@ant-design/icons": "5.5.2",
|
|
5
5
|
"antd": "5.22.5",
|
|
6
|
-
"@tachybase/server": "0.
|
|
6
|
+
"@tachybase/server": "1.0.6",
|
|
7
7
|
"antd-style": "3.7.1",
|
|
8
|
-
"@tachybase/schema": "0.
|
|
8
|
+
"@tachybase/schema": "1.0.6",
|
|
9
9
|
"lodash": "4.17.21",
|
|
10
10
|
"react-i18next": "15.2.0",
|
|
11
|
-
"@tachybase/actions": "0.
|
|
12
|
-
"@tachybase/utils": "0.
|
|
11
|
+
"@tachybase/actions": "1.0.6",
|
|
12
|
+
"@tachybase/utils": "1.0.6",
|
|
13
13
|
"axios": "1.7.7",
|
|
14
|
-
"@tachybase/database": "0.
|
|
14
|
+
"@tachybase/database": "1.0.6"
|
|
15
15
|
};
|
|
@@ -77,7 +77,7 @@ module.exports = __toCommonJS(aichat_controller_exports);
|
|
|
77
77
|
var import_utils = require("@tachybase/utils");
|
|
78
78
|
var import_axios = __toESM(require("axios"));
|
|
79
79
|
var _setAIsetting_dec, _getAIsetting_dec, _handleMessage_dec, _AIChatController_decorators, _init;
|
|
80
|
-
_AIChatController_decorators = [(0, import_utils.Controller)("aichat")], _handleMessage_dec = [(0, import_utils.Action)("sendMessage", { acl: "loggedIn" })], _getAIsetting_dec = [(0, import_utils.Action)("get", { acl: "
|
|
80
|
+
_AIChatController_decorators = [(0, import_utils.Controller)("aichat")], _handleMessage_dec = [(0, import_utils.Action)("sendMessage", { acl: "loggedIn" })], _getAIsetting_dec = [(0, import_utils.Action)("get", { acl: "private" })], _setAIsetting_dec = [(0, import_utils.Action)("set", { acl: "private" })];
|
|
81
81
|
class AIChatController {
|
|
82
82
|
constructor() {
|
|
83
83
|
__runInitializers(_init, 5, this);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/plugin-ai-chat",
|
|
3
3
|
"displayName": "AI Chat",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.6",
|
|
5
5
|
"description": "AI chatbot, providing operational help, intelligent Q&A",
|
|
6
6
|
"main": "dist/server/index.js",
|
|
7
7
|
"devDependencies": {
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"react-i18next": "^15.2.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@tachybase/actions": "0.
|
|
18
|
-
"@tachybase/
|
|
19
|
-
"@tachybase/
|
|
20
|
-
"@tachybase/
|
|
21
|
-
"@tachybase/test": "0.
|
|
22
|
-
"@tachybase/utils": "0.
|
|
23
|
-
"@tachybase/
|
|
17
|
+
"@tachybase/actions": "1.0.6",
|
|
18
|
+
"@tachybase/database": "1.0.6",
|
|
19
|
+
"@tachybase/schema": "1.0.6",
|
|
20
|
+
"@tachybase/server": "1.0.6",
|
|
21
|
+
"@tachybase/test": "1.0.6",
|
|
22
|
+
"@tachybase/utils": "1.0.6",
|
|
23
|
+
"@tachybase/client": "1.0.6"
|
|
24
24
|
},
|
|
25
25
|
"description.zh-CN": "AI聊天机器人,提供操作帮助,智能问答",
|
|
26
26
|
"displayName.zh-CN": "AI聊天"
|