mozi-bot 1.0.0
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/LICENSE +190 -0
- package/README.md +467 -0
- package/dist/agents/agent.d.ts +118 -0
- package/dist/agents/agent.d.ts.map +1 -0
- package/dist/agents/agent.js +686 -0
- package/dist/agents/agent.js.map +1 -0
- package/dist/agents/compaction.d.ts +78 -0
- package/dist/agents/compaction.d.ts.map +1 -0
- package/dist/agents/compaction.js +350 -0
- package/dist/agents/compaction.js.map +1 -0
- package/dist/agents/failover-error.d.ts +42 -0
- package/dist/agents/failover-error.d.ts.map +1 -0
- package/dist/agents/failover-error.js +171 -0
- package/dist/agents/failover-error.js.map +1 -0
- package/dist/agents/index.d.ts +10 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +10 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/model-fallback.d.ts +54 -0
- package/dist/agents/model-fallback.d.ts.map +1 -0
- package/dist/agents/model-fallback.js +227 -0
- package/dist/agents/model-fallback.js.map +1 -0
- package/dist/agents/session-store.d.ts +53 -0
- package/dist/agents/session-store.d.ts.map +1 -0
- package/dist/agents/session-store.js +217 -0
- package/dist/agents/session-store.js.map +1 -0
- package/dist/agents/system-prompt.d.ts +29 -0
- package/dist/agents/system-prompt.d.ts.map +1 -0
- package/dist/agents/system-prompt.js +299 -0
- package/dist/agents/system-prompt.js.map +1 -0
- package/dist/channels/common/base.d.ts +40 -0
- package/dist/channels/common/base.d.ts.map +1 -0
- package/dist/channels/common/base.js +23 -0
- package/dist/channels/common/base.js.map +1 -0
- package/dist/channels/common/index.d.ts +21 -0
- package/dist/channels/common/index.d.ts.map +1 -0
- package/dist/channels/common/index.js +66 -0
- package/dist/channels/common/index.js.map +1 -0
- package/dist/channels/dingtalk/api.d.ts +30 -0
- package/dist/channels/dingtalk/api.d.ts.map +1 -0
- package/dist/channels/dingtalk/api.js +149 -0
- package/dist/channels/dingtalk/api.js.map +1 -0
- package/dist/channels/dingtalk/events.d.ts +80 -0
- package/dist/channels/dingtalk/events.d.ts.map +1 -0
- package/dist/channels/dingtalk/events.js +92 -0
- package/dist/channels/dingtalk/events.js.map +1 -0
- package/dist/channels/dingtalk/index.d.ts +51 -0
- package/dist/channels/dingtalk/index.d.ts.map +1 -0
- package/dist/channels/dingtalk/index.js +231 -0
- package/dist/channels/dingtalk/index.js.map +1 -0
- package/dist/channels/dingtalk/stream.d.ts +31 -0
- package/dist/channels/dingtalk/stream.d.ts.map +1 -0
- package/dist/channels/dingtalk/stream.js +116 -0
- package/dist/channels/dingtalk/stream.js.map +1 -0
- package/dist/channels/feishu/api.d.ts +33 -0
- package/dist/channels/feishu/api.d.ts.map +1 -0
- package/dist/channels/feishu/api.js +120 -0
- package/dist/channels/feishu/api.js.map +1 -0
- package/dist/channels/feishu/events.d.ts +87 -0
- package/dist/channels/feishu/events.d.ts.map +1 -0
- package/dist/channels/feishu/events.js +163 -0
- package/dist/channels/feishu/events.js.map +1 -0
- package/dist/channels/feishu/index.d.ts +46 -0
- package/dist/channels/feishu/index.d.ts.map +1 -0
- package/dist/channels/feishu/index.js +207 -0
- package/dist/channels/feishu/index.js.map +1 -0
- package/dist/channels/feishu/websocket.d.ts +32 -0
- package/dist/channels/feishu/websocket.d.ts.map +1 -0
- package/dist/channels/feishu/websocket.js +121 -0
- package/dist/channels/feishu/websocket.js.map +1 -0
- package/dist/channels/index.d.ts +9 -0
- package/dist/channels/index.d.ts.map +1 -0
- package/dist/channels/index.js +9 -0
- package/dist/channels/index.js.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +468 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/index.d.ts +54 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +171 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/config/index.d.ts +201 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +261 -0
- package/dist/config/index.js.map +1 -0
- package/dist/gateway/index.d.ts +5 -0
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/gateway/index.js +5 -0
- package/dist/gateway/index.js.map +1 -0
- package/dist/gateway/server.d.ts +42 -0
- package/dist/gateway/server.d.ts.map +1 -0
- package/dist/gateway/server.js +235 -0
- package/dist/gateway/server.js.map +1 -0
- package/dist/hooks/index.d.ts +168 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +148 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/memory/index.d.ts +94 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +282 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/plugins/index.d.ts +57 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +103 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/providers/anthropic-compatible.d.ts +48 -0
- package/dist/providers/anthropic-compatible.d.ts.map +1 -0
- package/dist/providers/anthropic-compatible.js +380 -0
- package/dist/providers/anthropic-compatible.js.map +1 -0
- package/dist/providers/base.d.ts +26 -0
- package/dist/providers/base.d.ts.map +1 -0
- package/dist/providers/base.js +58 -0
- package/dist/providers/base.js.map +1 -0
- package/dist/providers/custom-openai.d.ts +66 -0
- package/dist/providers/custom-openai.d.ts.map +1 -0
- package/dist/providers/custom-openai.js +255 -0
- package/dist/providers/custom-openai.js.map +1 -0
- package/dist/providers/dashscope.d.ts +15 -0
- package/dist/providers/dashscope.d.ts.map +1 -0
- package/dist/providers/dashscope.js +237 -0
- package/dist/providers/dashscope.js.map +1 -0
- package/dist/providers/deepseek.d.ts +10 -0
- package/dist/providers/deepseek.d.ts.map +1 -0
- package/dist/providers/deepseek.js +57 -0
- package/dist/providers/deepseek.js.map +1 -0
- package/dist/providers/index.d.ts +33 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +142 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/kimi.d.ts +10 -0
- package/dist/providers/kimi.d.ts.map +1 -0
- package/dist/providers/kimi.js +83 -0
- package/dist/providers/kimi.js.map +1 -0
- package/dist/providers/minimax.d.ts +20 -0
- package/dist/providers/minimax.d.ts.map +1 -0
- package/dist/providers/minimax.js +252 -0
- package/dist/providers/minimax.js.map +1 -0
- package/dist/providers/modelscope.d.ts +15 -0
- package/dist/providers/modelscope.d.ts.map +1 -0
- package/dist/providers/modelscope.js +237 -0
- package/dist/providers/modelscope.js.map +1 -0
- package/dist/providers/openai-compatible.d.ts +57 -0
- package/dist/providers/openai-compatible.d.ts.map +1 -0
- package/dist/providers/openai-compatible.js +193 -0
- package/dist/providers/openai-compatible.js.map +1 -0
- package/dist/providers/stepfun.d.ts +10 -0
- package/dist/providers/stepfun.d.ts.map +1 -0
- package/dist/providers/stepfun.js +125 -0
- package/dist/providers/stepfun.js.map +1 -0
- package/dist/providers/zhipu.d.ts +15 -0
- package/dist/providers/zhipu.d.ts.map +1 -0
- package/dist/providers/zhipu.js +247 -0
- package/dist/providers/zhipu.js.map +1 -0
- package/dist/sessions/index.d.ts +6 -0
- package/dist/sessions/index.d.ts.map +1 -0
- package/dist/sessions/index.js +6 -0
- package/dist/sessions/index.js.map +1 -0
- package/dist/sessions/store.d.ts +45 -0
- package/dist/sessions/store.d.ts.map +1 -0
- package/dist/sessions/store.js +268 -0
- package/dist/sessions/store.js.map +1 -0
- package/dist/sessions/types.d.ts +110 -0
- package/dist/sessions/types.d.ts.map +1 -0
- package/dist/sessions/types.js +6 -0
- package/dist/sessions/types.js.map +1 -0
- package/dist/tools/builtin/apply-patch.d.ts +8 -0
- package/dist/tools/builtin/apply-patch.d.ts.map +1 -0
- package/dist/tools/builtin/apply-patch.js +272 -0
- package/dist/tools/builtin/apply-patch.js.map +1 -0
- package/dist/tools/builtin/bash.d.ts +25 -0
- package/dist/tools/builtin/bash.d.ts.map +1 -0
- package/dist/tools/builtin/bash.js +212 -0
- package/dist/tools/builtin/bash.js.map +1 -0
- package/dist/tools/builtin/browser.d.ts +12 -0
- package/dist/tools/builtin/browser.d.ts.map +1 -0
- package/dist/tools/builtin/browser.js +693 -0
- package/dist/tools/builtin/browser.js.map +1 -0
- package/dist/tools/builtin/filesystem.d.ts +29 -0
- package/dist/tools/builtin/filesystem.d.ts.map +1 -0
- package/dist/tools/builtin/filesystem.js +484 -0
- package/dist/tools/builtin/filesystem.js.map +1 -0
- package/dist/tools/builtin/image.d.ts +13 -0
- package/dist/tools/builtin/image.d.ts.map +1 -0
- package/dist/tools/builtin/image.js +126 -0
- package/dist/tools/builtin/image.js.map +1 -0
- package/dist/tools/builtin/index.d.ts +30 -0
- package/dist/tools/builtin/index.d.ts.map +1 -0
- package/dist/tools/builtin/index.js +55 -0
- package/dist/tools/builtin/index.js.map +1 -0
- package/dist/tools/builtin/process-registry.d.ts +71 -0
- package/dist/tools/builtin/process-registry.d.ts.map +1 -0
- package/dist/tools/builtin/process-registry.js +172 -0
- package/dist/tools/builtin/process-registry.js.map +1 -0
- package/dist/tools/builtin/process-tool.d.ts +8 -0
- package/dist/tools/builtin/process-tool.d.ts.map +1 -0
- package/dist/tools/builtin/process-tool.js +279 -0
- package/dist/tools/builtin/process-tool.js.map +1 -0
- package/dist/tools/builtin/subagent.d.ts +33 -0
- package/dist/tools/builtin/subagent.d.ts.map +1 -0
- package/dist/tools/builtin/subagent.js +185 -0
- package/dist/tools/builtin/subagent.js.map +1 -0
- package/dist/tools/builtin/system.d.ts +11 -0
- package/dist/tools/builtin/system.d.ts.map +1 -0
- package/dist/tools/builtin/system.js +144 -0
- package/dist/tools/builtin/system.js.map +1 -0
- package/dist/tools/builtin/web.d.ts +9 -0
- package/dist/tools/builtin/web.d.ts.map +1 -0
- package/dist/tools/builtin/web.js +87 -0
- package/dist/tools/builtin/web.js.map +1 -0
- package/dist/tools/common.d.ts +45 -0
- package/dist/tools/common.d.ts.map +1 -0
- package/dist/tools/common.js +129 -0
- package/dist/tools/common.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/registry.d.ts +33 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +174 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +58 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +11 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/types/index.d.ts +280 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +34 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +35 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +114 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +24 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +94 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/web/index.d.ts +7 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +7 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/static.d.ts +12 -0
- package/dist/web/static.d.ts.map +1 -0
- package/dist/web/static.js +1260 -0
- package/dist/web/static.js.map +1 -0
- package/dist/web/types.d.ts +95 -0
- package/dist/web/types.d.ts.map +1 -0
- package/dist/web/types.js +5 -0
- package/dist/web/types.js.map +1 -0
- package/dist/web/websocket.d.ts +58 -0
- package/dist/web/websocket.d.ts.map +1 -0
- package/dist/web/websocket.js +371 -0
- package/dist/web/websocket.js.map +1 -0
- package/package.json +89 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2024 Mozi Contributors
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
# Mozi (墨子)
|
|
2
|
+
|
|
3
|
+
**支持国产大模型和国产通讯软件的智能助手框架**
|
|
4
|
+
|
|
5
|
+
Mozi 是一个轻量级的 AI 助手框架,专注于国产生态。它提供统一的接口对接多种国产 AI 模型(DeepSeek、Qwen、Kimi 等),支持 OpenAI Function Calling,并能在飞书、钉钉、WebChat 等平台上运行。
|
|
6
|
+
|
|
7
|
+
## 与 Moltbot 对比
|
|
8
|
+
|
|
9
|
+
Mozi 的架构设计参考了 [Moltbot](https://github.com/moltbot/moltbot),但专注于不同的使用场景。
|
|
10
|
+
|
|
11
|
+
| 特性 | Mozi | Moltbot |
|
|
12
|
+
|------|------|---------|
|
|
13
|
+
| **定位** | 国产生态优先的轻量框架 | 全功能个人 AI 助手 |
|
|
14
|
+
| **代码量** | ~16,000 行 (64 文件) | ~516,000 行 (3,137 文件) |
|
|
15
|
+
| **国产模型** | ✅ DeepSeek、Qwen、Kimi、阶跃星辰、MiniMax | ❌ 仅 Anthropic、OpenAI |
|
|
16
|
+
| **国产通讯** | ✅ 飞书、钉钉原生支持 | ❌ WhatsApp、Telegram、Slack 等海外平台 |
|
|
17
|
+
| **Node.js 版本** | ≥18 | ≥22 |
|
|
18
|
+
| **资源占用** | 轻量 | 较重(菜单栏应用、语音唤醒等) |
|
|
19
|
+
| **适用场景** | 企业内部机器人、国内团队协作 | 个人多设备助手、海外平台集成 |
|
|
20
|
+
|
|
21
|
+
> **Mozi 用 3% 的代码量实现了核心功能**,专注简洁高效,易于理解和二次开发。
|
|
22
|
+
|
|
23
|
+
### 选择 Mozi 的理由
|
|
24
|
+
|
|
25
|
+
- **国产模型一站式支持** — 无需翻墙,直接对接 DeepSeek、通义千问等国产大模型
|
|
26
|
+
- **飞书/钉钉开箱即用** — 原生支持国内主流办公平台,配置简单
|
|
27
|
+
- **轻量快速** — 专注核心功能,无冗余依赖,启动快、资源占用少
|
|
28
|
+
- **低门槛** — 一个 API Key + 三行配置即可运行,适合快速验证和部署
|
|
29
|
+
- **企业友好** — 适合国内企业内网环境,无外部依赖
|
|
30
|
+
|
|
31
|
+
### 选择 Moltbot 的理由
|
|
32
|
+
|
|
33
|
+
- 需要 WhatsApp、Telegram、Discord 等海外平台支持
|
|
34
|
+
- 需要语音唤醒、Live Canvas 等高级交互功能
|
|
35
|
+
- 需要多设备同步、macOS/iOS 深度集成
|
|
36
|
+
- 个人使用场景,设备控制需求
|
|
37
|
+
|
|
38
|
+
## 核心特性
|
|
39
|
+
|
|
40
|
+
- **多模型支持** — DeepSeek、ModelScope (Qwen)、Kimi、阶跃星辰、MiniMax,以及 OpenAI/Anthropic 兼容格式
|
|
41
|
+
- **多平台通道** — WebChat、飞书、钉钉,统一的消息处理接口
|
|
42
|
+
- **Function Calling** — 原生支持 OpenAI tools/tool_choice 参数
|
|
43
|
+
- **15+ 内置工具** — 文件读写、Bash 执行、代码搜索、网页获取等
|
|
44
|
+
- **会话管理** — 上下文压缩、会话持久化、Memory 向量记忆
|
|
45
|
+
- **可扩展** — 插件系统、Hook 事件、自定义工具
|
|
46
|
+
|
|
47
|
+
## 快速开始
|
|
48
|
+
|
|
49
|
+
### 环境要求
|
|
50
|
+
|
|
51
|
+
- Node.js >= 18
|
|
52
|
+
- npm / pnpm / yarn
|
|
53
|
+
|
|
54
|
+
### 1. 安装
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# 一键安装(推荐)
|
|
58
|
+
npm install -g mozi-bot
|
|
59
|
+
|
|
60
|
+
# 或者克隆项目
|
|
61
|
+
git clone https://github.com/King-Chau/mozi.git
|
|
62
|
+
cd mozi && npm install && npm run build
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 2. 配置
|
|
66
|
+
|
|
67
|
+
创建配置文件 `config.local.json5`(会被 git 忽略):
|
|
68
|
+
|
|
69
|
+
```json5
|
|
70
|
+
{
|
|
71
|
+
providers: {
|
|
72
|
+
// 至少配置一个模型提供商
|
|
73
|
+
deepseek: {
|
|
74
|
+
apiKey: "sk-your-deepseek-key"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
agent: {
|
|
78
|
+
defaultProvider: "deepseek",
|
|
79
|
+
defaultModel: "deepseek-chat"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
或者使用环境变量:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
export DEEPSEEK_API_KEY=sk-your-key
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 3. 启动
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# 启动 WebChat(本地调试)
|
|
94
|
+
npm run dev -- start --web-only
|
|
95
|
+
|
|
96
|
+
# 或构建后启动
|
|
97
|
+
npm start -- start --web-only
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
打开浏览器访问 `http://localhost:3000` 即可开始对话。
|
|
101
|
+
|
|
102
|
+
### 4. 连接通讯平台(可选)
|
|
103
|
+
|
|
104
|
+
如需连接飞书或钉钉,添加相应配置后启动完整服务:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
npm start -- start
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 支持的模型提供商
|
|
111
|
+
|
|
112
|
+
### 国产模型
|
|
113
|
+
|
|
114
|
+
| 提供商 | 环境变量 | 说明 |
|
|
115
|
+
|--------|----------|------|
|
|
116
|
+
| DeepSeek | `DEEPSEEK_API_KEY` | 推理能力强、性价比高 |
|
|
117
|
+
| DashScope | `DASHSCOPE_API_KEY` | 阿里云灵积,通义千问商业版,稳定高并发 |
|
|
118
|
+
| 智谱 AI | `ZHIPU_API_KEY` | GLM-4 系列,清华技术团队,有免费额度 |
|
|
119
|
+
| ModelScope | `MODELSCOPE_API_KEY` | 阿里云魔搭社区,Qwen 开源版,有免费额度 |
|
|
120
|
+
| Kimi | `KIMI_API_KEY` | Moonshot,长上下文支持(128K/1M) |
|
|
121
|
+
| 阶跃星辰 | `STEPFUN_API_KEY` | Step 系列,多模态能力 |
|
|
122
|
+
| MiniMax | `MINIMAX_API_KEY` | 语音、视觉能力 |
|
|
123
|
+
|
|
124
|
+
### 海外模型
|
|
125
|
+
|
|
126
|
+
| 提供商 | 环境变量 | 说明 |
|
|
127
|
+
|--------|----------|------|
|
|
128
|
+
| OpenAI | `OPENAI_API_KEY` | GPT-4o、GPT-4、GPT-3.5 |
|
|
129
|
+
| OpenRouter | `OPENROUTER_API_KEY` | 聚合多家模型,统一 API |
|
|
130
|
+
| Together AI | `TOGETHER_API_KEY` | 开源模型托管,Llama、Mixtral 等 |
|
|
131
|
+
| Groq | `GROQ_API_KEY` | 超快推理速度 |
|
|
132
|
+
|
|
133
|
+
### 本地部署
|
|
134
|
+
|
|
135
|
+
| 提供商 | 环境变量 | 说明 |
|
|
136
|
+
|--------|----------|------|
|
|
137
|
+
| Ollama | `OLLAMA_BASE_URL` | 本地运行开源模型 |
|
|
138
|
+
|
|
139
|
+
### 自定义接口
|
|
140
|
+
|
|
141
|
+
支持配置任意 OpenAI/Anthropic 兼容的 API 接口,详见「模型提供商配置」章节。
|
|
142
|
+
|
|
143
|
+
## 配置说明
|
|
144
|
+
|
|
145
|
+
支持 `config.local.json5`、`config.json5`、`config.yaml` 等格式,优先级从高到低。
|
|
146
|
+
|
|
147
|
+
### 模型提供商配置
|
|
148
|
+
|
|
149
|
+
所有内置提供商都支持自定义模型配置:
|
|
150
|
+
|
|
151
|
+
```json5
|
|
152
|
+
{
|
|
153
|
+
providers: {
|
|
154
|
+
// 内置提供商 - 直接配置 apiKey 即可使用预设模型
|
|
155
|
+
deepseek: {
|
|
156
|
+
apiKey: "sk-xxx"
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
// 内置提供商 + 自定义模型列表
|
|
160
|
+
dashscope: {
|
|
161
|
+
apiKey: "sk-xxx",
|
|
162
|
+
models: [
|
|
163
|
+
{
|
|
164
|
+
id: "qwen-max-latest",
|
|
165
|
+
name: "通义千问 Max",
|
|
166
|
+
contextWindow: 32768,
|
|
167
|
+
maxTokens: 8192
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: "qwen-plus-latest",
|
|
171
|
+
name: "通义千问 Plus",
|
|
172
|
+
contextWindow: 131072,
|
|
173
|
+
maxTokens: 8192
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
// 自定义 OpenAI 兼容接口
|
|
179
|
+
"custom-provider": {
|
|
180
|
+
id: "my-provider",
|
|
181
|
+
name: "My Provider",
|
|
182
|
+
baseUrl: "https://api.example.com/v1",
|
|
183
|
+
apiKey: "xxx",
|
|
184
|
+
models: [
|
|
185
|
+
{
|
|
186
|
+
id: "model-id",
|
|
187
|
+
name: "Model Name",
|
|
188
|
+
contextWindow: 32768,
|
|
189
|
+
maxTokens: 4096,
|
|
190
|
+
supportsVision: false,
|
|
191
|
+
supportsTools: true
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 通讯平台配置
|
|
200
|
+
|
|
201
|
+
飞书和钉钉都支持两种连接模式:
|
|
202
|
+
|
|
203
|
+
| 模式 | 说明 | 适用场景 |
|
|
204
|
+
|------|------|----------|
|
|
205
|
+
| **长连接(默认)** | WebSocket/Stream 主动连接,无需公网 IP | 内网部署、本地开发 |
|
|
206
|
+
| Webhook | 被动接收回调,需要公网可访问地址 | 公网服务器部署 |
|
|
207
|
+
|
|
208
|
+
```json5
|
|
209
|
+
{
|
|
210
|
+
channels: {
|
|
211
|
+
// 飞书配置
|
|
212
|
+
feishu: {
|
|
213
|
+
appId: "cli_xxx",
|
|
214
|
+
appSecret: "xxx",
|
|
215
|
+
mode: "websocket" // "websocket"(默认)或 "webhook"
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
// 钉钉配置
|
|
219
|
+
dingtalk: {
|
|
220
|
+
appKey: "xxx",
|
|
221
|
+
appSecret: "xxx",
|
|
222
|
+
mode: "stream" // "stream"(默认)或 "webhook"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
> **推荐使用长连接模式**:无需公网 IP,无需配置回调地址,启动即可接收消息。
|
|
229
|
+
|
|
230
|
+
### 完整配置示例
|
|
231
|
+
|
|
232
|
+
```json5
|
|
233
|
+
{
|
|
234
|
+
// 模型提供商配置
|
|
235
|
+
providers: {
|
|
236
|
+
deepseek: {
|
|
237
|
+
apiKey: "sk-xxx"
|
|
238
|
+
},
|
|
239
|
+
dashscope: {
|
|
240
|
+
apiKey: "sk-xxx" // 阿里云灵积 API Key
|
|
241
|
+
},
|
|
242
|
+
zhipu: {
|
|
243
|
+
apiKey: "xxx" // 智谱 API Key
|
|
244
|
+
},
|
|
245
|
+
modelscope: {
|
|
246
|
+
apiKey: "ms-xxx"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
// 通讯平台配置(长连接模式,无需公网)
|
|
251
|
+
channels: {
|
|
252
|
+
feishu: {
|
|
253
|
+
appId: "cli_xxx",
|
|
254
|
+
appSecret: "xxx",
|
|
255
|
+
mode: "websocket" // 默认值,可省略
|
|
256
|
+
},
|
|
257
|
+
dingtalk: {
|
|
258
|
+
appKey: "xxx",
|
|
259
|
+
appSecret: "xxx",
|
|
260
|
+
mode: "stream" // 默认值,可省略
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
// Agent 配置
|
|
265
|
+
agent: {
|
|
266
|
+
defaultProvider: "deepseek",
|
|
267
|
+
defaultModel: "deepseek-chat",
|
|
268
|
+
temperature: 0.7,
|
|
269
|
+
maxTokens: 4096,
|
|
270
|
+
systemPrompt: "你是墨子,一个智能助手。"
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
// 服务器配置
|
|
274
|
+
server: {
|
|
275
|
+
port: 3000,
|
|
276
|
+
host: "0.0.0.0"
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
// 日志级别
|
|
280
|
+
logging: {
|
|
281
|
+
level: "info" // debug | info | warn | error
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## 内置工具
|
|
287
|
+
|
|
288
|
+
| 类别 | 工具 | 说明 |
|
|
289
|
+
|------|------|------|
|
|
290
|
+
| 文件 | `read_file` | 读取文件内容 |
|
|
291
|
+
| | `write_file` | 写入/创建文件 |
|
|
292
|
+
| | `edit_file` | 精确字符串替换 |
|
|
293
|
+
| | `list_directory` | 列出目录内容 |
|
|
294
|
+
| | `glob` | 按模式搜索文件 |
|
|
295
|
+
| | `grep` | 按内容搜索文件 |
|
|
296
|
+
| | `apply_patch` | 应用 diff 补丁 |
|
|
297
|
+
| 命令 | `bash` | 执行 Bash 命令 |
|
|
298
|
+
| | `process` | 管理后台进程 |
|
|
299
|
+
| 网络 | `web_search` | 网络搜索 |
|
|
300
|
+
| | `web_fetch` | 获取网页内容 |
|
|
301
|
+
| 其他 | `current_time` | 获取当前时间 |
|
|
302
|
+
| | `calculator` | 数学计算 |
|
|
303
|
+
|
|
304
|
+
## 平台配置
|
|
305
|
+
|
|
306
|
+
### 飞书
|
|
307
|
+
|
|
308
|
+
#### 长连接模式(推荐)
|
|
309
|
+
|
|
310
|
+
无需公网 IP,适合内网部署和本地开发:
|
|
311
|
+
|
|
312
|
+
1. 登录 [飞书开放平台](https://open.feishu.cn/),创建企业自建应用
|
|
313
|
+
2. 获取 App ID 和 App Secret
|
|
314
|
+
3. 启用「机器人」能力
|
|
315
|
+
4. 添加权限:`im:message`、`im:message.group_at_msg`
|
|
316
|
+
5. 进入「事件订阅」,将订阅方式设置为「使用长连接接收事件」
|
|
317
|
+
6. 添加事件:`im.message.receive_v1`(接收消息)
|
|
318
|
+
7. 配置完成,启动服务即可
|
|
319
|
+
|
|
320
|
+
```json5
|
|
321
|
+
{
|
|
322
|
+
channels: {
|
|
323
|
+
feishu: {
|
|
324
|
+
appId: "cli_xxx",
|
|
325
|
+
appSecret: "xxx"
|
|
326
|
+
// mode: "websocket" 是默认值,可省略
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
#### Webhook 模式
|
|
333
|
+
|
|
334
|
+
需要公网可访问地址:
|
|
335
|
+
|
|
336
|
+
1. 完成上述步骤 1-4
|
|
337
|
+
2. 配置事件订阅地址:`http://your-server:3000/webhook/feishu`
|
|
338
|
+
3. 订阅事件:`im.message.receive_v1`
|
|
339
|
+
|
|
340
|
+
```json5
|
|
341
|
+
{
|
|
342
|
+
channels: {
|
|
343
|
+
feishu: {
|
|
344
|
+
appId: "cli_xxx",
|
|
345
|
+
appSecret: "xxx",
|
|
346
|
+
mode: "webhook"
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### 钉钉
|
|
353
|
+
|
|
354
|
+
#### 长连接模式(推荐)
|
|
355
|
+
|
|
356
|
+
无需公网 IP,使用官方 Stream SDK:
|
|
357
|
+
|
|
358
|
+
1. 登录 [钉钉开放平台](https://open.dingtalk.com/),创建企业内部应用
|
|
359
|
+
2. 获取 AppKey 和 AppSecret
|
|
360
|
+
3. 添加「机器人」能力
|
|
361
|
+
4. 在机器人配置页面,消息接收模式选择「Stream 模式」
|
|
362
|
+
5. 配置完成,启动服务即可
|
|
363
|
+
|
|
364
|
+
```json5
|
|
365
|
+
{
|
|
366
|
+
channels: {
|
|
367
|
+
dingtalk: {
|
|
368
|
+
appKey: "xxx",
|
|
369
|
+
appSecret: "xxx"
|
|
370
|
+
// mode: "stream" 是默认值,可省略
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
#### Webhook 模式
|
|
377
|
+
|
|
378
|
+
需要公网可访问地址:
|
|
379
|
+
|
|
380
|
+
1. 完成上述步骤 1-3
|
|
381
|
+
2. 配置消息接收地址:`http://your-server:3000/webhook/dingtalk`
|
|
382
|
+
|
|
383
|
+
```json5
|
|
384
|
+
{
|
|
385
|
+
channels: {
|
|
386
|
+
dingtalk: {
|
|
387
|
+
appKey: "xxx",
|
|
388
|
+
appSecret: "xxx",
|
|
389
|
+
mode: "webhook"
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
## CLI 命令
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
# 启动服务
|
|
399
|
+
mozi start # 完整服务(含飞书/钉钉)
|
|
400
|
+
mozi start --web-only # 仅 WebChat
|
|
401
|
+
mozi start --port 8080 # 指定端口
|
|
402
|
+
|
|
403
|
+
# 查看日志
|
|
404
|
+
mozi logs # 查看最新日志(默认 50 行)
|
|
405
|
+
mozi logs -n 100 # 查看最新 100 行
|
|
406
|
+
mozi logs -f # 实时跟踪日志(类似 tail -f)
|
|
407
|
+
mozi logs --level error # 只显示错误日志
|
|
408
|
+
|
|
409
|
+
# 其他命令
|
|
410
|
+
mozi check # 检查配置
|
|
411
|
+
mozi models # 列出可用模型
|
|
412
|
+
mozi chat # 命令行聊天
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
> 日志文件存储在 `~/.mozi/logs/` 目录下,按日期自动轮转。
|
|
416
|
+
|
|
417
|
+
## 项目结构
|
|
418
|
+
|
|
419
|
+
```
|
|
420
|
+
src/
|
|
421
|
+
├── agents/ # Agent 核心(会话、上下文压缩)
|
|
422
|
+
├── channels/ # 通道适配器(飞书、钉钉)
|
|
423
|
+
├── providers/ # 模型提供商
|
|
424
|
+
├── tools/ # 内置工具
|
|
425
|
+
├── web/ # WebChat 前端
|
|
426
|
+
├── config/ # 配置加载
|
|
427
|
+
├── gateway/ # HTTP 网关
|
|
428
|
+
└── types/ # 类型定义
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
## API 使用
|
|
432
|
+
|
|
433
|
+
```typescript
|
|
434
|
+
import { loadConfig, initializeProviders, getProvider } from "mozi";
|
|
435
|
+
|
|
436
|
+
const config = loadConfig();
|
|
437
|
+
initializeProviders(config);
|
|
438
|
+
|
|
439
|
+
const provider = getProvider("deepseek");
|
|
440
|
+
const response = await provider.chat({
|
|
441
|
+
model: "deepseek-chat",
|
|
442
|
+
messages: [{ role: "user", content: "你好!" }],
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
console.log(response.content);
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
## Star History
|
|
449
|
+
|
|
450
|
+
[](https://star-history.com/#King-Chau/mozi&Date)
|
|
451
|
+
|
|
452
|
+
## 开发
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
# 开发模式(自动重启)
|
|
456
|
+
npm run dev -- start --web-only
|
|
457
|
+
|
|
458
|
+
# 类型检查
|
|
459
|
+
npm run typecheck
|
|
460
|
+
|
|
461
|
+
# 构建
|
|
462
|
+
npm run build
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
## License
|
|
466
|
+
|
|
467
|
+
Apache 2.0
|