mtxuilib 0.1.227 → 0.1.228

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.
Files changed (41) hide show
  1. package/dist/components/devtools/DebugValue.d.ts +5 -0
  2. package/dist/components/devtools/DebugValue.js +15 -0
  3. package/dist/components/devtools/DevTools.d.ts +6 -0
  4. package/dist/components/devtools/DevTools.js +26 -0
  5. package/package.json +2 -2
  6. package/dist/components/tool-ui/BlogHomePage.d.ts +0 -5
  7. package/dist/components/tool-ui/BlogHomePage.js +0 -8
  8. package/dist/components/tool-ui/BlogHomePage.z.d.ts +0 -60
  9. package/dist/components/tool-ui/BlogHomePage.z.js +0 -20
  10. package/dist/components/tool-ui/DemoCategoryGen.d.ts +0 -3
  11. package/dist/components/tool-ui/DemoCategoryGen.js +0 -8
  12. package/dist/components/tool-ui/OpenBrowser.d.ts +0 -1
  13. package/dist/components/tool-ui/OpenBrowser.js +0 -25
  14. package/dist/tools/countDown.d.ts +0 -32
  15. package/dist/tools/countDown.js +0 -35
  16. package/dist/tools/devTools/cloudflareTunnel.d.ts +0 -17
  17. package/dist/tools/devTools/cloudflareTunnel.js +0 -43
  18. package/dist/tools/devTools/docker-compose.d.ts +0 -8
  19. package/dist/tools/devTools/docker-compose.js +0 -13
  20. package/dist/tools/devTools/dpMtCfWorkerTool.d.ts +0 -8
  21. package/dist/tools/devTools/dpMtCfWorkerTool.js +0 -13
  22. package/dist/tools/devTools/getIp.d.ts +0 -14
  23. package/dist/tools/devTools/getIp.js +0 -29
  24. package/dist/tools/devTools/installOsPackages.d.ts +0 -8
  25. package/dist/tools/devTools/installOsPackages.js +0 -29
  26. package/dist/tools/devTools/ollamaService.d.ts +0 -14
  27. package/dist/tools/devTools/ollamaService.js +0 -26
  28. package/dist/tools/devTools/vncServer.d.ts +0 -1
  29. package/dist/tools/devTools/vncServer.js +0 -1
  30. package/dist/tools/genSiteHeaderBarsTool.d.ts +0 -14
  31. package/dist/tools/genSiteHeaderBarsTool.js +0 -16
  32. package/dist/tools/hello1Tool.d.ts +0 -14
  33. package/dist/tools/hello1Tool.js +0 -15
  34. package/dist/tools/rag/getInformation.d.ts +0 -18
  35. package/dist/tools/rag/getInformation.js +0 -15
  36. package/dist/tools/search/exampleSearchTool.d.ts +0 -8
  37. package/dist/tools/search/exampleSearchTool.js +0 -13
  38. package/dist/tools/webbot/callAdminBot.d.ts +0 -8
  39. package/dist/tools/webbot/callAdminBot.js +0 -14
  40. package/dist/tools/welcomeAdminTool.d.ts +0 -8
  41. package/dist/tools/welcomeAdminTool.js +0 -13
@@ -0,0 +1,5 @@
1
+ export declare const DebugValue: (props: {
2
+ title?: string;
3
+ data: any;
4
+ className?: string;
5
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Dialog, DialogContent, DialogTrigger } from "mtxuilib/ui/dialog";
4
+ import { MtButton } from "mtxuilib/ui/mt/Button";
5
+ import { useState } from "react";
6
+ export const DebugValue = (props) => {
7
+ const { title, data, className } = props;
8
+ const [open, setOpen] = useState(false);
9
+ if (process.env.NODE_ENV === "production") {
10
+ return null;
11
+ }
12
+ return (_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(DialogTrigger, { asChild: true, children: _jsx(MtButton, { variant: "outline", className: className, onClick: () => {
13
+ console.log(data);
14
+ }, children: title || "debug" }) }), _jsx(DialogContent, { className: "max-h-lvh w-full overflow-scroll bg-red-100", children: _jsx("pre", { className: " text-xs", children: JSON.stringify(data, null, 2) }) })] }));
15
+ };
@@ -0,0 +1,6 @@
1
+ interface DevToolsProps {
2
+ open?: boolean;
3
+ onOpenChange?: (open: boolean) => void;
4
+ }
5
+ export declare const DevTools: (props: DevToolsProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { TailwindIndicator } from "mtxuilib/common/tailwind-indicator";
4
+ import dynamic from "next/dynamic";
5
+ import { useState } from "react";
6
+ import { useHotkeys } from "react-hotkeys-hook";
7
+ const ReactQueryDevtoolsProduction = dynamic(() => import("@tanstack/react-query-devtools/build/modern/production.js").then((d) => ({
8
+ default: d.ReactQueryDevtools,
9
+ })), {
10
+ ssr: false,
11
+ });
12
+ const hotKeyDebug = "alt+.";
13
+ export const DevTools = (props) => {
14
+ const { open: propsOpen, onOpenChange } = props;
15
+ const [internalOpen, setInternalOpen] = useState(false);
16
+ const open = propsOpen ?? internalOpen;
17
+ const setOpen = onOpenChange ?? setInternalOpen;
18
+ useHotkeys(hotKeyDebug, () => {
19
+ console.log("debug2:%o", !open);
20
+ setOpen(!open);
21
+ }, [open, setOpen]);
22
+ if (!open) {
23
+ return null;
24
+ }
25
+ return (_jsxs(_Fragment, { children: [_jsx(ReactQueryDevtoolsProduction, { buttonPosition: "bottom-right" }), _jsx(TailwindIndicator, {})] }));
26
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mtxuilib",
3
3
  "private": false,
4
- "version": "0.1.227",
4
+ "version": "0.1.228",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -22,7 +22,6 @@
22
22
  }
23
23
  },
24
24
  "exports": {
25
- "./package.json": "./package.json",
26
25
  ".": {
27
26
  "types": [
28
27
  "./src/index.ts",
@@ -47,6 +46,7 @@
47
46
  "./src/*/index.tsx"
48
47
  ],
49
48
  "import": [
49
+ "./dist/index.js",
50
50
  "./dist/*.js",
51
51
  "./dist/*.jsx",
52
52
  "./dist/*/index.js",
@@ -1,5 +0,0 @@
1
- import { z } from "zod";
2
- import { homePageSchema } from "./BlogHomePage.z";
3
- export default function BlogHomePage(props: {
4
- params: z.infer<typeof homePageSchema>;
5
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- export default function BlogHomePage(props) {
4
- const { params } = props;
5
- return (_jsxs("div", { className: "prose bg-yellow-100 p-1", children: [_jsx("h1", { children: params.htmlTitle }), _jsx("div", { className: "bg-lime-200 flex gap-2", children: params.categories?.map((item, i) => {
6
- return _jsx("div", { children: item.label });
7
- }) })] }));
8
- }
@@ -1,60 +0,0 @@
1
- import { z } from "zod";
2
- export declare const homePageSchema: z.ZodObject<{
3
- htmlTitle: z.ZodString;
4
- theme: z.ZodString;
5
- categories: z.ZodArray<z.ZodObject<{
6
- href: z.ZodString;
7
- label: z.ZodString;
8
- }, "strip", z.ZodTypeAny, {
9
- label: string;
10
- href: string;
11
- }, {
12
- label: string;
13
- href: string;
14
- }>, "many">;
15
- blogCardItems: z.ZodArray<z.ZodObject<{
16
- title: z.ZodString;
17
- summary: z.ZodString;
18
- author: z.ZodString;
19
- date: z.ZodString;
20
- }, "strip", z.ZodTypeAny, {
21
- summary: string;
22
- title: string;
23
- date: string;
24
- author: string;
25
- }, {
26
- summary: string;
27
- title: string;
28
- date: string;
29
- author: string;
30
- }>, "many">;
31
- footHtml: z.ZodString;
32
- }, "strip", z.ZodTypeAny, {
33
- theme: string;
34
- htmlTitle: string;
35
- categories: {
36
- label: string;
37
- href: string;
38
- }[];
39
- blogCardItems: {
40
- summary: string;
41
- title: string;
42
- date: string;
43
- author: string;
44
- }[];
45
- footHtml: string;
46
- }, {
47
- theme: string;
48
- htmlTitle: string;
49
- categories: {
50
- label: string;
51
- href: string;
52
- }[];
53
- blogCardItems: {
54
- summary: string;
55
- title: string;
56
- date: string;
57
- author: string;
58
- }[];
59
- footHtml: string;
60
- }>;
@@ -1,20 +0,0 @@
1
- import { z } from "zod";
2
- export const homePageSchema = z.object({
3
- htmlTitle: z.string(),
4
- theme: z.string(),
5
- categories: z
6
- .object({
7
- href: z.string(),
8
- label: z.string(),
9
- })
10
- .array(),
11
- blogCardItems: z
12
- .object({
13
- title: z.string(),
14
- summary: z.string(),
15
- author: z.string(),
16
- date: z.string(),
17
- })
18
- .array(),
19
- footHtml: z.string(),
20
- });
@@ -1,3 +0,0 @@
1
- export declare const DemoCategoryGen: (props: {
2
- categoryTexts: string[];
3
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- export const DemoCategoryGen = (props) => {
4
- const { categoryTexts } = props;
5
- return (_jsx("div", { className: "bg-blue-400 p-2", children: categoryTexts?.map((item, i) => {
6
- return _jsx("li", { children: item }, i);
7
- }) }));
8
- };
@@ -1 +0,0 @@
1
- export declare function OpenBrowserActionForm(): import("react/jsx-runtime").JSX.Element;
@@ -1,25 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { EditFormToolbar } from "mtxuilib/form/EditFormToolbar";
4
- import { ZForm, useZodForm } from "mtxuilib/form/ZodForm";
5
- import { useMtRouter } from "mtxuilib/hooks/use-router";
6
- import { FormControl, FormField, FormItem, FormLabel, FormMessage, } from "mtxuilib/ui/form";
7
- import { z } from "zod";
8
- import { MtInput } from "../../ui/mt/inputs/input";
9
- export function OpenBrowserActionForm() {
10
- const router = useMtRouter();
11
- const form = useZodForm({
12
- schema: z.any(),
13
- defaultValues: {
14
- request: {
15
- url: "https://www.baidu.com",
16
- },
17
- },
18
- });
19
- const handleSubmit = async (values) => {
20
- form.reset();
21
- };
22
- return (_jsxs(_Fragment, { children: [_jsx(ZForm, { form: form, handleSubmit: handleSubmit, className: "space-y-2", children: _jsx(FormField, { control: form.control, name: "url", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "url" }), _jsx(FormControl, { children: _jsx(MtInput, { placeholder: "url", ...form.register("url") }) }), _jsx(FormMessage, {})] })) }) }), _jsx(EditFormToolbar, { form: form, onCancel: () => {
23
- router.back();
24
- }, className: "bg-primary-500 border p-2 font-bold text-white" })] }));
25
- }
@@ -1,32 +0,0 @@
1
- import { z } from "zod";
2
- export declare const countDownTool: {
3
- countDown: {
4
- description: string;
5
- parameters: z.ZodObject<{
6
- stepLabel: z.ZodString;
7
- stepValue: z.ZodDefault<z.ZodNumber>;
8
- startValue: z.ZodDefault<z.ZodNumber>;
9
- endValue: z.ZodDefault<z.ZodNumber>;
10
- endMessage: z.ZodString;
11
- }, "strip", z.ZodTypeAny, {
12
- stepLabel: string;
13
- stepValue: number;
14
- startValue: number;
15
- endValue: number;
16
- endMessage: string;
17
- }, {
18
- stepLabel: string;
19
- endMessage: string;
20
- stepValue?: number | undefined;
21
- startValue?: number | undefined;
22
- endValue?: number | undefined;
23
- }>;
24
- generate: ({ stepValue, startValue, endValue, stepLabel, endMessage, }: {
25
- stepValue: any;
26
- startValue: any;
27
- endValue: any;
28
- stepLabel: any;
29
- endMessage: any;
30
- }) => AsyncGenerator<import("react/jsx-runtime").JSX.Element, import("react/jsx-runtime").JSX.Element, unknown>;
31
- };
32
- };
@@ -1,35 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { z } from "zod";
3
- import { BotCard } from "../components/message";
4
- import { sleep } from "../lib/utils";
5
- export const countDownTool = {
6
- countDown: {
7
- description: "以秒未单位的计数器,如果用户未指定具体数字,则从9开始倒数到0,必须使用中文",
8
- parameters: z.object({
9
- stepLabel: z
10
- .string()
11
- .describe("显示在数字左侧的短文本,当快结束时应该提醒用户,默认应该根据实际场景显示约5个字符的词语,例如:当前“还剩:”"),
12
- stepValue: z.number().default(1).describe("步长,每秒增加值,可以是负数"),
13
- startValue: z.number().min(0).max(100).default(1).describe("起始值"),
14
- endValue: z.number().min(0).max(100).default(11).describe("结束值"),
15
- endMessage: z.string().describe("倒数结束后,显示给用户看的一句话"),
16
- }),
17
- generate: async function* ({ stepValue, startValue, endValue, stepLabel, endMessage, }) {
18
- console.log("计数:", startValue, endValue, stepLabel, endMessage);
19
- yield (_jsx(BotCard, { children: "\u52A0\u8F7D\u4E2D" }));
20
- let _start = startValue;
21
- let _end = endValue;
22
- if (startValue > endValue) {
23
- _start = endValue;
24
- _end = startValue;
25
- }
26
- let curr = _end;
27
- while (curr !== _start) {
28
- curr += stepValue;
29
- await sleep(1000);
30
- yield (_jsxs(BotCard, { children: [stepLabel, " ", curr] }));
31
- }
32
- return _jsx(BotCard, { children: endMessage });
33
- },
34
- },
35
- };
@@ -1,17 +0,0 @@
1
- import { z } from "zod";
2
- export declare const netTunnelTool: {
3
- netTunnel: {
4
- description: string;
5
- parameters: z.ZodObject<{
6
- action: z.ZodEnum<["start", "stop"]>;
7
- token: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- action: "stop" | "start";
10
- token?: string | undefined;
11
- }, {
12
- action: "stop" | "start";
13
- token?: string | undefined;
14
- }>;
15
- generate: (params: any) => AsyncGenerator<import("react/jsx-runtime").JSX.Element, import("react/jsx-runtime").JSX.Element, unknown>;
16
- };
17
- };
@@ -1,43 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { exec } from "mtxlib/exec";
3
- import { z } from "zod";
4
- import { BotCard } from "../../components/message";
5
- export const netTunnelTool = {
6
- netTunnel: {
7
- description: "启动或者停止网络通道,将调用 cloudflared 命令",
8
- parameters: z.object({
9
- action: z.enum(["start", "stop"]),
10
- token: z.string().optional().describe("token of cloudflared tunnel"),
11
- }),
12
- generate: async function* (params) {
13
- yield _jsx(BotCard, { children: "\u52A0\u8F7D\u4E2D" });
14
- try {
15
- yield (_jsx(BotCard, { children: _jsxs("div", { children: ["\u8C03\u7528 cloudflare \u52A8\u4F5C\uFF1A", params.action] }) }));
16
- const result = await cftunnel_gitpod(params.action);
17
- return (_jsxs(BotCard, { children: ["\u901A\u9053\u64CD\u4F5C\u5B8C\u6BD5 ", _jsx("pre", { children: JSON.stringify(result, null, 2) })] }));
18
- }
19
- catch (e) {
20
- return (_jsxs(BotCard, { children: [_jsx("h3", { children: "\u9519\u8BEF\u6458\u8981\uFF1A" }), _jsx("pre", { children: e.toString() }), _jsx("div", { children: "\u66F4\u5177\u4F53\u7684\u9519\u8BEF\u4FE1\u606F\uFF0C\u8BF7\u5230\u540E\u53F0\u67E5\u770B" })] }));
21
- }
22
- },
23
- },
24
- };
25
- async function cftunnel_gitpod(action) {
26
- if (action === "start") {
27
- console.log("启动 cftunnel_gitpod");
28
- await exec(`command -v cloudflared || (curl -o /usr/bin/cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 \
29
- && chmod +x /usr/bin/cloudflared)`, {
30
- shell: true,
31
- env: { ...process.env },
32
- });
33
- const cloudflareTunnelToken = "eyJhIjoiNjIzZmFmNzJlZTBkMmFmM2U1ODZlN2NkOWRhZGI3MmIiLCJ0IjoiNmUyMWMwNjAtZjRkOC00NmJjLTk2NjEtODA1M2M0ZGE0MzRlIiwicyI6Ill6TmpPREpoWWpVdE5EWTRNUzAwTVdSbExUazVZbVl0TXpGalpHSmlNRE14WXpOaSJ9";
34
- exec(`cloudflared tunnel --no-autoupdate run --token ${cloudflareTunnelToken}`, {
35
- shell: true,
36
- });
37
- }
38
- else {
39
- await exec("pkill cloudflared", {
40
- shell: true,
41
- });
42
- }
43
- }
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
- export declare const dockerComposeTool: {
3
- dockerCompose: {
4
- description: string;
5
- parameters: z.ZodAny;
6
- generate: (params: any) => AsyncGenerator<import("react/jsx-runtime").JSX.Element, import("react/jsx-runtime").JSX.Element, unknown>;
7
- };
8
- };
@@ -1,13 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { z } from "zod";
3
- import { BotCard } from "../../components/message";
4
- export const dockerComposeTool = {
5
- dockerCompose: {
6
- description: "调用 docker-compose up",
7
- parameters: z.any(),
8
- generate: async function* (params) {
9
- yield _jsx(BotCard, { children: "\u52A0\u8F7D\u4E2D" });
10
- return (_jsx(BotCard, { children: _jsx("div", { className: "bg-blue-100 p-2 flex gap-2" }) }));
11
- },
12
- },
13
- };
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
- export declare const deployMtcfWorkerTool: {
3
- deployMtcfWorker: {
4
- description: string;
5
- parameters: z.ZodAny;
6
- generate: (params: any) => AsyncGenerator<import("react/jsx-runtime").JSX.Element, import("react/jsx-runtime").JSX.Element, unknown>;
7
- };
8
- };
@@ -1,13 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { z } from "zod";
3
- import { BotCard } from "../../components/message";
4
- export const deployMtcfWorkerTool = {
5
- deployMtcfWorker: {
6
- description: "调用本地脚本,将 mtcf 项目部署到 cloudflare worker",
7
- parameters: z.any(),
8
- generate: async function* (params) {
9
- yield _jsx(BotCard, { children: "\u52A0\u8F7D\u4E2D" });
10
- return (_jsx(BotCard, { children: _jsx("div", { className: "bg-blue-100 p-2 flex gap-2" }) }));
11
- },
12
- },
13
- };
@@ -1,14 +0,0 @@
1
- import { z } from "zod";
2
- export declare const getExternalIpTool: {
3
- getExternalIp: {
4
- description: string;
5
- parameters: z.ZodObject<{
6
- provider: z.ZodOptional<z.ZodString>;
7
- }, "strip", z.ZodTypeAny, {
8
- provider?: string | undefined;
9
- }, {
10
- provider?: string | undefined;
11
- }>;
12
- generate: (params: any) => AsyncGenerator<import("react/jsx-runtime").JSX.Element, import("react/jsx-runtime").JSX.Element, unknown>;
13
- };
14
- };
@@ -1,29 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { z } from "zod";
3
- import { BotCard } from "../../components/message";
4
- export const getExternalIpTool = {
5
- getExternalIp: {
6
- description: "通过请问第三方api 获取当前服务器对外请求的公网IP",
7
- parameters: z.object({
8
- provider: z
9
- .string()
10
- .optional()
11
- .describe("ip 查询供应商名称,一般可以不填"),
12
- }),
13
- generate: async function* (params) {
14
- yield _jsx(BotCard, { children: "\u52A0\u8F7D\u4E2D" });
15
- try {
16
- yield _jsx(BotCard, { children: "\u5F00\u59CB\u8BF7\u6C42\u5916\u7F51\uFF0C\u63A2\u6D4B\u5F53\u524D\u670D\u52A1\u5668\u7684IP" });
17
- const ipInfo = await getIp();
18
- return (_jsxs(BotCard, { children: ["\u63A2\u6D4B\u5B8C\u6210\uFF0C\u4FE1\u606F\uFF1A ", _jsx("pre", { children: JSON.stringify(ipInfo, null, 2) })] }));
19
- }
20
- catch (e) {
21
- return (_jsxs(BotCard, { children: [_jsx("h3", { children: "\u9519\u8BEF\u6458\u8981\uFF1A" }), _jsx("pre", { children: e.toString() }), _jsx("div", { children: "\u66F4\u5177\u4F53\u7684\u9519\u8BEF\u4FE1\u606F\uFF0C\u8BF7\u5230\u540E\u53F0\u67E5\u770B" })] }));
22
- }
23
- },
24
- },
25
- };
26
- async function getIp() {
27
- const ipInfo = await fetch("https://ifconfig.me/all.json").then((x) => x.json());
28
- return ipInfo;
29
- }
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
- export declare const installOsPackagesTool: {
3
- installOsPackages: {
4
- description: string;
5
- parameters: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
6
- generate: (params: any) => AsyncGenerator<import("react/jsx-runtime").JSX.Element, import("react/jsx-runtime").JSX.Element, unknown>;
7
- };
8
- };
@@ -1,29 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { exec } from "mtxlib/exec";
3
- import { z } from "zod";
4
- import { BotCard } from "../../components/message";
5
- export const installOsPackagesTool = {
6
- installOsPackages: {
7
- description: "在当前 linux 系统,安装常用的工具软件,内部将使用 类似 apt get install -y git curl 的方式安装管理员已经预先指定的软件包",
8
- parameters: z
9
- .object({})
10
- .optional(),
11
- generate: async function* (params) {
12
- yield _jsx(BotCard, { children: "\u52A0\u8F7D\u4E2D" });
13
- try {
14
- yield _jsx(BotCard, { children: "\u5F00\u59CB\u8BF7\u6C42\u5916\u7F51\uFF0C\u63A2\u6D4B\u5F53\u524D\u670D\u52A1\u5668\u7684IP" });
15
- const result = await installOsPackages();
16
- return (_jsxs(BotCard, { children: ["\u6267\u884C\u5B8C\u6BD5", _jsx("pre", { children: JSON.stringify(result, null, 2) })] }));
17
- }
18
- catch (e) {
19
- return (_jsxs(BotCard, { children: [_jsx("h3", { children: "\u9519\u8BEF\u6458\u8981\uFF1A" }), _jsx("pre", { children: e.toString() }), _jsx("div", { children: "\u66F4\u5177\u4F53\u7684\u9519\u8BEF\u4FE1\u606F\uFF0C\u8BF7\u5230\u540E\u53F0\u67E5\u770B" })] }));
20
- }
21
- },
22
- },
23
- };
24
- async function installOsPackages() {
25
- await exec(` if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
26
- echo "Running apt-get update..."
27
- sudo apt update
28
- fi`, { shell: true });
29
- }
@@ -1,14 +0,0 @@
1
- import { z } from "zod";
2
- export declare const ollamaServiceTool: {
3
- ollamaService: {
4
- description: string;
5
- parameters: z.ZodObject<{
6
- action: z.ZodEnum<["start", "stop"]>;
7
- }, "strip", z.ZodTypeAny, {
8
- action: "stop" | "start";
9
- }, {
10
- action: "stop" | "start";
11
- }>;
12
- generate: (params: any) => AsyncGenerator<import("react/jsx-runtime").JSX.Element, import("react/jsx-runtime").JSX.Element, unknown>;
13
- };
14
- };
@@ -1,26 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { z } from "zod";
3
- import { exec } from "mtxlib/exec";
4
- import { BotCard } from "../../components/message";
5
- export const ollamaServiceTool = {
6
- ollamaService: {
7
- description: "启动或通知本地ollama服务",
8
- parameters: z.object({
9
- action: z.enum(["start", "stop"]).describe("动作类型,启动或停止"),
10
- }),
11
- generate: async function* (params) {
12
- yield _jsx(BotCard, { children: "loading" });
13
- try {
14
- const a = await exec("ollama ", { shell: true });
15
- return _jsx(BotCard, { children: "\u5B8C\u6210" });
16
- }
17
- catch (e) {
18
- return (_jsxs(BotCard, { children: [_jsx("h3", { children: "\u9519\u8BEF\u6458\u8981\uFF1A" }), _jsx("pre", { children: e.toString() }), _jsx("div", { children: "\u66F4\u5177\u4F53\u7684\u9519\u8BEF\u4FE1\u606F\uFF0C\u8BF7\u5230\u540E\u53F0\u67E5\u770B" })] }));
19
- }
20
- },
21
- },
22
- };
23
- async function getIp() {
24
- const ipInfo = await fetch("https://ifconfig.me/all.json").then((x) => x.json());
25
- return ipInfo;
26
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,14 +0,0 @@
1
- import { z } from "zod";
2
- export declare const genSiteHeaderBarsTool: {
3
- genSiteHeaderBars: {
4
- description: string;
5
- parameters: z.ZodObject<{
6
- categories: z.ZodArray<z.ZodString, "many">;
7
- }, "strip", z.ZodTypeAny, {
8
- categories: string[];
9
- }, {
10
- categories: string[];
11
- }>;
12
- generate: (params: any) => AsyncGenerator<import("react/jsx-runtime").JSX.Element, import("react/jsx-runtime").JSX.Element, unknown>;
13
- };
14
- };
@@ -1,16 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { z } from "zod";
3
- import { BotCard } from "../components/message";
4
- import { DemoCategoryGen } from "../components/tool-ui/DemoCategoryGen";
5
- export const genSiteHeaderBarsTool = {
6
- genSiteHeaderBars: {
7
- description: "生成网站上方的导航栏的分类目录",
8
- parameters: z.object({
9
- categories: z.string().array(),
10
- }),
11
- generate: async function* (params) {
12
- yield _jsx(BotCard, { children: "\u52A0\u8F7D\u4E2D" });
13
- return (_jsx(BotCard, { children: _jsx(DemoCategoryGen, { categoryTexts: params.categories }) }));
14
- },
15
- },
16
- };
@@ -1,14 +0,0 @@
1
- import { z } from "zod";
2
- export declare const welcomeTool: {
3
- welcome: {
4
- description: string;
5
- parameters: z.ZodObject<{
6
- message: z.ZodString;
7
- }, "strip", z.ZodTypeAny, {
8
- message: string;
9
- }, {
10
- message: string;
11
- }>;
12
- generate: (params: any) => AsyncGenerator<import("react/jsx-runtime").JSX.Element, import("react/jsx-runtime").JSX.Element, unknown>;
13
- };
14
- };
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { z } from "zod";
3
- import { BotCard } from "../components/message";
4
- export const welcomeTool = {
5
- welcome: {
6
- description: "welcome screen",
7
- parameters: z.object({
8
- message: z.string().describe("show some message to user"),
9
- }),
10
- generate: async function* (params) {
11
- yield _jsx(BotCard, { children: "loading" });
12
- return (_jsx(BotCard, { children: _jsx("div", { className: "bg-blue-100 p-2 flex gap-2 prose", children: _jsx("h1", { children: params.params }) }) }));
13
- },
14
- },
15
- };
@@ -1,18 +0,0 @@
1
- import { z } from "zod";
2
- export declare const getInformationTool: {
3
- getInformation: import("ai").CoreTool<z.ZodObject<{
4
- question: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- question: string;
7
- }, {
8
- question: string;
9
- }>, {
10
- data: string;
11
- }> & {
12
- execute: (args: {
13
- question: string;
14
- }) => PromiseLike<{
15
- data: string;
16
- }>;
17
- };
18
- };
@@ -1,15 +0,0 @@
1
- import { tool } from "ai";
2
- import { z } from "zod";
3
- export const getInformationTool = {
4
- getInformation: tool({
5
- description: "get information from your knowledge base to answer questions.",
6
- parameters: z.object({
7
- question: z.string().describe("the users question"),
8
- }),
9
- execute: async ({ question }) => {
10
- return {
11
- data: "data123",
12
- };
13
- },
14
- }),
15
- };
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
- export declare const demoSearchTool: {
3
- demoSearch: {
4
- description: string;
5
- parameters: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
6
- generate: (params: any) => AsyncGenerator<import("react/jsx-runtime").JSX.Element, import("react/jsx-runtime").JSX.Element, unknown>;
7
- };
8
- };
@@ -1,13 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { z } from "zod";
3
- import { BotCard } from "../../components/message";
4
- export const demoSearchTool = {
5
- demoSearch: {
6
- description: "用户互联网搜索,可以根据给定的关键字,从搜索引擎获取到内容",
7
- parameters: z.object({}).optional(),
8
- generate: async function* (params) {
9
- yield _jsx(BotCard, { children: "\u52A0\u8F7D\u4E2D" });
10
- return (_jsx(BotCard, { children: "demo search" }));
11
- },
12
- },
13
- };
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
- export declare const callAdminBotTool: {
3
- adminBot: {
4
- description: string;
5
- parameters: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
6
- generate: (params: any) => AsyncGenerator<import("react/jsx-runtime").JSX.Element, import("react/jsx-runtime").JSX.Element, unknown>;
7
- };
8
- };
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { z } from "zod";
3
- import { BotCard } from "../../components/message";
4
- import { MtButton } from "../../ui/mt/Button";
5
- export const callAdminBotTool = {
6
- adminBot: {
7
- description: "调用“高级机器人”,能让用户在界面上看到具有更高前线的机器人的按钮",
8
- parameters: z.object({}),
9
- generate: async function* (params) {
10
- yield _jsx(BotCard, { children: "\u52A0\u8F7D\u4E2D" });
11
- return (_jsx(BotCard, { children: _jsx(MtButton, { children: "\u70B9\u51FB\u6253\u5F00\u9AD8\u9636\u673A\u5668\u4EBA" }) }));
12
- },
13
- },
14
- };
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
- export declare const welcomeAdminUser: {
3
- dockerCompose: {
4
- description: string;
5
- parameters: z.ZodAny;
6
- generate: (params: any) => AsyncGenerator<import("react/jsx-runtime").JSX.Element, import("react/jsx-runtime").JSX.Element, unknown>;
7
- };
8
- };
@@ -1,13 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { z } from "zod";
3
- import { BotCard } from "../components/message";
4
- export const welcomeAdminUser = {
5
- dockerCompose: {
6
- description: "欢迎系统系统管理员,工具会显示基本的操作按钮共管理员点击使用",
7
- parameters: z.any(),
8
- generate: async function* (params) {
9
- yield _jsx(BotCard, { children: "\u52A0\u8F7D\u4E2D" });
10
- return (_jsx(BotCard, { children: _jsx("div", { className: "bg-blue-100 p-2 flex gap-2", children: "\u6B22\u8FCE\u8D85\u7EA7\u7BA1\u7406\u5458" }) }));
11
- },
12
- },
13
- };