@tachybase/plugin-ai-chat 0.23.49 → 1.0.18

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.
@@ -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"}})});
@@ -1,15 +1,15 @@
1
1
  module.exports = {
2
2
  "react": "18.3.1",
3
- "@tachybase/client": "0.23.58",
3
+ "@tachybase/client": "1.0.18",
4
4
  "@ant-design/icons": "5.5.2",
5
5
  "antd": "5.22.5",
6
- "@tachybase/server": "0.23.58",
6
+ "@tachybase/server": "1.0.18",
7
7
  "antd-style": "3.7.1",
8
- "@tachybase/schema": "0.23.58",
8
+ "@tachybase/schema": "1.0.18",
9
9
  "lodash": "4.17.21",
10
10
  "react-i18next": "15.2.0",
11
- "@tachybase/actions": "0.23.58",
12
- "@tachybase/utils": "0.23.58",
11
+ "@tachybase/actions": "1.0.18",
12
+ "@tachybase/utils": "1.0.18",
13
13
  "axios": "1.7.7",
14
- "@tachybase/database": "0.23.58"
14
+ "@tachybase/database": "1.0.18"
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: "priviate" })], _setAIsetting_dec = [(0, import_utils.Action)("set", { acl: "priviate" })];
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.23.49",
4
+ "version": "1.0.18",
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.23.58",
18
- "@tachybase/client": "0.23.58",
19
- "@tachybase/database": "0.23.58",
20
- "@tachybase/schema": "0.23.58",
21
- "@tachybase/test": "0.23.58",
22
- "@tachybase/utils": "0.23.58",
23
- "@tachybase/server": "0.23.58"
17
+ "@tachybase/actions": "1.0.18",
18
+ "@tachybase/client": "1.0.18",
19
+ "@tachybase/database": "1.0.18",
20
+ "@tachybase/test": "1.0.18",
21
+ "@tachybase/schema": "1.0.18",
22
+ "@tachybase/server": "1.0.18",
23
+ "@tachybase/utils": "1.0.18"
24
24
  },
25
25
  "description.zh-CN": "AI聊天机器人,提供操作帮助,智能问答",
26
26
  "displayName.zh-CN": "AI聊天"