dsh-plugin-image-workbench 1.1.5 → 1.1.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.
Files changed (172) hide show
  1. package/LICENSE +21 -21
  2. package/README.en.md +5 -3
  3. package/README.md +7 -3
  4. package/client.js +241 -241
  5. package/cordis.patch.yml +14 -14
  6. package/host.js +51 -0
  7. package/install.mjs +333 -387
  8. package/package.json +3 -2
  9. package/scripts/fetch-style-images.mjs +104 -0
  10. package/scripts/vendor-snapshot.py +154 -154
  11. package/server/access.py +26 -26
  12. package/server/app.py +1329 -1329
  13. package/server/catalog.py +147 -147
  14. package/server/composer.py +391 -391
  15. package/server/drafts.py +158 -158
  16. package/server/history.py +575 -575
  17. package/server/imaging.py +172 -172
  18. package/server/pool.py +1335 -1335
  19. package/server/pool_admin.py +921 -921
  20. package/server/pool_service.py +1073 -1073
  21. package/server/requirements.txt +6 -6
  22. package/server/smoke_check.py +402 -402
  23. package/server/static/access.html +202 -202
  24. package/vendor/chatgpt2api/source/.env.example +82 -82
  25. package/vendor/chatgpt2api/source/.python-version +1 -1
  26. package/vendor/chatgpt2api/source/LICENSE +21 -21
  27. package/vendor/chatgpt2api/source/README.md +391 -391
  28. package/vendor/chatgpt2api/source/VERSION +1 -1
  29. package/vendor/chatgpt2api/source/api/__init__.py +2 -2
  30. package/vendor/chatgpt2api/source/api/accounts.py +537 -537
  31. package/vendor/chatgpt2api/source/api/ai.py +217 -217
  32. package/vendor/chatgpt2api/source/api/app.py +62 -62
  33. package/vendor/chatgpt2api/source/api/errors.py +46 -46
  34. package/vendor/chatgpt2api/source/api/image_inputs.py +309 -309
  35. package/vendor/chatgpt2api/source/api/image_tasks.py +120 -120
  36. package/vendor/chatgpt2api/source/api/support.py +134 -134
  37. package/vendor/chatgpt2api/source/api/system.py +365 -365
  38. package/vendor/chatgpt2api/source/assets/kunrouai.svg +50 -50
  39. package/vendor/chatgpt2api/source/config.default.json +108 -108
  40. package/vendor/chatgpt2api/source/main.py +9 -9
  41. package/vendor/chatgpt2api/source/pyproject.toml +27 -27
  42. package/vendor/chatgpt2api/source/scripts/init_proxy_config.py +186 -186
  43. package/vendor/chatgpt2api/source/scripts/migrate_storage.py +163 -163
  44. package/vendor/chatgpt2api/source/scripts/privoxy-warp.conf +13 -13
  45. package/vendor/chatgpt2api/source/scripts/test_outlook_token_mailbox.py +385 -385
  46. package/vendor/chatgpt2api/source/scripts/test_storage.py +129 -129
  47. package/vendor/chatgpt2api/source/scripts/verify_oauth_refresh.py +92 -92
  48. package/vendor/chatgpt2api/source/services/account_service.py +1757 -1757
  49. package/vendor/chatgpt2api/source/services/auth_service.py +253 -253
  50. package/vendor/chatgpt2api/source/services/backup_service.py +671 -671
  51. package/vendor/chatgpt2api/source/services/config.py +667 -667
  52. package/vendor/chatgpt2api/source/services/content_filter.py +242 -242
  53. package/vendor/chatgpt2api/source/services/cpa_service.py +315 -315
  54. package/vendor/chatgpt2api/source/services/editable_file_task_service.py +260 -260
  55. package/vendor/chatgpt2api/source/services/image_service.py +376 -376
  56. package/vendor/chatgpt2api/source/services/image_storage_service.py +405 -405
  57. package/vendor/chatgpt2api/source/services/image_tags_service.py +76 -76
  58. package/vendor/chatgpt2api/source/services/image_task_service.py +550 -550
  59. package/vendor/chatgpt2api/source/services/log_service.py +337 -337
  60. package/vendor/chatgpt2api/source/services/model_service.py +182 -182
  61. package/vendor/chatgpt2api/source/services/oauth_login_service.py +267 -267
  62. package/vendor/chatgpt2api/source/services/openai_backend_api.py +2763 -2763
  63. package/vendor/chatgpt2api/source/services/openai_oauth.py +32 -32
  64. package/vendor/chatgpt2api/source/services/protocol/__init__.py +2 -2
  65. package/vendor/chatgpt2api/source/services/protocol/anthropic_v1_messages.py +307 -307
  66. package/vendor/chatgpt2api/source/services/protocol/chat_completion_cache.py +238 -238
  67. package/vendor/chatgpt2api/source/services/protocol/conversation.py +1644 -1644
  68. package/vendor/chatgpt2api/source/services/protocol/error_response.py +124 -124
  69. package/vendor/chatgpt2api/source/services/protocol/openai_search.py +19 -19
  70. package/vendor/chatgpt2api/source/services/protocol/openai_v1_chat_complete.py +316 -316
  71. package/vendor/chatgpt2api/source/services/protocol/openai_v1_image_edit.py +86 -86
  72. package/vendor/chatgpt2api/source/services/protocol/openai_v1_image_generations.py +42 -42
  73. package/vendor/chatgpt2api/source/services/protocol/openai_v1_models.py +53 -53
  74. package/vendor/chatgpt2api/source/services/protocol/openai_v1_response.py +453 -453
  75. package/vendor/chatgpt2api/source/services/protocol/web_search_tool.py +160 -160
  76. package/vendor/chatgpt2api/source/services/proxy_service.py +648 -648
  77. package/vendor/chatgpt2api/source/services/storage/__init__.py +5 -5
  78. package/vendor/chatgpt2api/source/services/storage/base.py +38 -38
  79. package/vendor/chatgpt2api/source/services/storage/database_storage.py +194 -194
  80. package/vendor/chatgpt2api/source/services/storage/factory.py +104 -104
  81. package/vendor/chatgpt2api/source/services/storage/git_storage.py +183 -183
  82. package/vendor/chatgpt2api/source/services/storage/json_storage.py +95 -95
  83. package/vendor/chatgpt2api/source/services/sub2api_service.py +531 -531
  84. package/vendor/chatgpt2api/source/utils/helper.py +469 -469
  85. package/vendor/chatgpt2api/source/utils/image_tokens.py +346 -346
  86. package/vendor/chatgpt2api/source/utils/log.py +110 -110
  87. package/vendor/chatgpt2api/source/utils/pkce.py +19 -19
  88. package/vendor/chatgpt2api/source/utils/pow.py +207 -207
  89. package/vendor/chatgpt2api/source/utils/sentinel.py +159 -159
  90. package/vendor/chatgpt2api/source/utils/turnstile.py +184 -184
  91. package/vendor/chatgpt2api/source/uv.lock +904 -904
  92. package/vendor/chatgpt2api/source/web/bun.lock +1501 -1501
  93. package/vendor/chatgpt2api/source/web/components.json +24 -24
  94. package/vendor/chatgpt2api/source/web/eslint.config.mjs +17 -17
  95. package/vendor/chatgpt2api/source/web/next.config.ts +40 -40
  96. package/vendor/chatgpt2api/source/web/package.json +58 -58
  97. package/vendor/chatgpt2api/source/web/postcss.config.mjs +5 -5
  98. package/vendor/chatgpt2api/source/web/src/app/accounts/components/account-import-dialog.tsx +925 -925
  99. package/vendor/chatgpt2api/source/web/src/app/accounts/page.tsx +1307 -1307
  100. package/vendor/chatgpt2api/source/web/src/app/debug/components/chat-panel.tsx +224 -224
  101. package/vendor/chatgpt2api/source/web/src/app/debug/components/editable-file-panel.tsx +444 -444
  102. package/vendor/chatgpt2api/source/web/src/app/debug/components/ppt-panel.tsx +9 -9
  103. package/vendor/chatgpt2api/source/web/src/app/debug/components/psd-panel.tsx +9 -9
  104. package/vendor/chatgpt2api/source/web/src/app/debug/components/search-panel.tsx +172 -172
  105. package/vendor/chatgpt2api/source/web/src/app/debug/components/skill-panel.tsx +169 -169
  106. package/vendor/chatgpt2api/source/web/src/app/debug/components/types.ts +39 -39
  107. package/vendor/chatgpt2api/source/web/src/app/debug/page.tsx +59 -59
  108. package/vendor/chatgpt2api/source/web/src/app/globals.css +230 -230
  109. package/vendor/chatgpt2api/source/web/src/app/image/components/image-composer.tsx +542 -542
  110. package/vendor/chatgpt2api/source/web/src/app/image/components/image-results.tsx +554 -554
  111. package/vendor/chatgpt2api/source/web/src/app/image/components/image-sidebar.tsx +176 -176
  112. package/vendor/chatgpt2api/source/web/src/app/image/page.tsx +1799 -1799
  113. package/vendor/chatgpt2api/source/web/src/app/image-manager/page.tsx +732 -732
  114. package/vendor/chatgpt2api/source/web/src/app/layout.tsx +50 -50
  115. package/vendor/chatgpt2api/source/web/src/app/login/page.tsx +101 -101
  116. package/vendor/chatgpt2api/source/web/src/app/logs/page.tsx +356 -356
  117. package/vendor/chatgpt2api/source/web/src/app/page.tsx +30 -30
  118. package/vendor/chatgpt2api/source/web/src/app/settings/components/api-docs-card.tsx +341 -341
  119. package/vendor/chatgpt2api/source/web/src/app/settings/components/backup-settings-card.tsx +447 -447
  120. package/vendor/chatgpt2api/source/web/src/app/settings/components/base-url-card.tsx +71 -71
  121. package/vendor/chatgpt2api/source/web/src/app/settings/components/config-card.tsx +491 -491
  122. package/vendor/chatgpt2api/source/web/src/app/settings/components/cpa-pool-dialog.tsx +108 -108
  123. package/vendor/chatgpt2api/source/web/src/app/settings/components/cpa-pools-card.tsx +169 -169
  124. package/vendor/chatgpt2api/source/web/src/app/settings/components/import-browser-dialog.tsx +185 -185
  125. package/vendor/chatgpt2api/source/web/src/app/settings/components/proxy-runtime-card.tsx +379 -379
  126. package/vendor/chatgpt2api/source/web/src/app/settings/components/proxy-settings-card.tsx +127 -127
  127. package/vendor/chatgpt2api/source/web/src/app/settings/components/proxy-settings.tsx +200 -200
  128. package/vendor/chatgpt2api/source/web/src/app/settings/components/settings-header.tsx +12 -12
  129. package/vendor/chatgpt2api/source/web/src/app/settings/components/sub2api-connections.tsx +886 -886
  130. package/vendor/chatgpt2api/source/web/src/app/settings/components/third-party-apps-card.tsx +81 -81
  131. package/vendor/chatgpt2api/source/web/src/app/settings/components/user-keys-card.tsx +422 -422
  132. package/vendor/chatgpt2api/source/web/src/app/settings/page.tsx +135 -135
  133. package/vendor/chatgpt2api/source/web/src/app/settings/store.ts +1069 -1069
  134. package/vendor/chatgpt2api/source/web/src/components/date-range-filter.tsx +49 -49
  135. package/vendor/chatgpt2api/source/web/src/components/header-actions.tsx +24 -24
  136. package/vendor/chatgpt2api/source/web/src/components/image-lightbox.tsx +434 -434
  137. package/vendor/chatgpt2api/source/web/src/components/image-thumbnail.tsx +46 -46
  138. package/vendor/chatgpt2api/source/web/src/components/theme-script.tsx +18 -18
  139. package/vendor/chatgpt2api/source/web/src/components/theme-toggle.tsx +14 -14
  140. package/vendor/chatgpt2api/source/web/src/components/top-nav.tsx +263 -263
  141. package/vendor/chatgpt2api/source/web/src/components/ui/animated-theme-toggler.tsx +256 -256
  142. package/vendor/chatgpt2api/source/web/src/components/ui/badge.tsx +41 -41
  143. package/vendor/chatgpt2api/source/web/src/components/ui/button.tsx +59 -59
  144. package/vendor/chatgpt2api/source/web/src/components/ui/calendar.tsx +46 -46
  145. package/vendor/chatgpt2api/source/web/src/components/ui/card.tsx +61 -61
  146. package/vendor/chatgpt2api/source/web/src/components/ui/checkbox.tsx +27 -27
  147. package/vendor/chatgpt2api/source/web/src/components/ui/dia-text-reveal.tsx +267 -267
  148. package/vendor/chatgpt2api/source/web/src/components/ui/dialog.tsx +132 -132
  149. package/vendor/chatgpt2api/source/web/src/components/ui/field.tsx +13 -13
  150. package/vendor/chatgpt2api/source/web/src/components/ui/input.tsx +19 -19
  151. package/vendor/chatgpt2api/source/web/src/components/ui/label.tsx +24 -24
  152. package/vendor/chatgpt2api/source/web/src/components/ui/morphing-text.tsx +149 -149
  153. package/vendor/chatgpt2api/source/web/src/components/ui/popover.tsx +38 -38
  154. package/vendor/chatgpt2api/source/web/src/components/ui/select.tsx +175 -175
  155. package/vendor/chatgpt2api/source/web/src/components/ui/sheet.tsx +143 -143
  156. package/vendor/chatgpt2api/source/web/src/components/ui/table.tsx +29 -29
  157. package/vendor/chatgpt2api/source/web/src/components/ui/tabs.tsx +91 -91
  158. package/vendor/chatgpt2api/source/web/src/components/ui/text-3d-flip.tsx +269 -269
  159. package/vendor/chatgpt2api/source/web/src/components/ui/textarea.tsx +18 -18
  160. package/vendor/chatgpt2api/source/web/src/components/version-release-dialog.tsx +127 -127
  161. package/vendor/chatgpt2api/source/web/src/constants/common-env.ts +6 -6
  162. package/vendor/chatgpt2api/source/web/src/hooks/use-version-check.ts +85 -85
  163. package/vendor/chatgpt2api/source/web/src/lib/api.ts +926 -926
  164. package/vendor/chatgpt2api/source/web/src/lib/auth-session.ts +26 -26
  165. package/vendor/chatgpt2api/source/web/src/lib/release.ts +25 -25
  166. package/vendor/chatgpt2api/source/web/src/lib/request.ts +93 -93
  167. package/vendor/chatgpt2api/source/web/src/lib/use-auth-guard.ts +89 -89
  168. package/vendor/chatgpt2api/source/web/src/lib/utils.ts +6 -6
  169. package/vendor/chatgpt2api/source/web/src/store/auth.ts +112 -112
  170. package/vendor/chatgpt2api/source/web/src/store/editable-file-history.ts +33 -33
  171. package/vendor/chatgpt2api/source/web/src/store/image-conversations.ts +318 -318
  172. package/vendor/chatgpt2api/source/web/tsconfig.json +42 -42
@@ -1,169 +1,169 @@
1
- "use client";
2
-
3
- import { useEffect, useMemo, useState } from "react";
4
- import { Copy, Download } from "lucide-react";
5
- import { toast } from "sonner";
6
-
7
- import { Button } from "@/components/ui/button";
8
- import webConfig from "@/constants/common-env";
9
- import { fetchSettingsConfig } from "@/lib/api";
10
- import { getStoredAuthSession } from "@/store/auth";
11
-
12
- export function SkillPanel() {
13
- const [browserBaseUrl, setBrowserBaseUrl] = useState("");
14
- const [configuredBaseUrl, setConfiguredBaseUrl] = useState("");
15
- const [authKey, setAuthKey] = useState("");
16
-
17
- useEffect(() => {
18
- setBrowserBaseUrl(window.location.origin);
19
- void fetchSettingsConfig().then((data) => setConfiguredBaseUrl(String(data.config.base_url || "").replace(/\/$/, ""))).catch(() => undefined);
20
- void getStoredAuthSession().then((session) => setAuthKey(session?.key || ""));
21
- }, []);
22
-
23
- const apiBaseUrl = configuredBaseUrl || webConfig.apiUrl.replace(/\/$/, "") || browserBaseUrl;
24
- const skillZh = useMemo(() => `---
25
- name: chatgpt2api-search
26
- description: 当用户需要联网搜索、查询最新信息、核实事实或需要来源链接时,调用本地 chatgpt2api 搜索接口。
27
- ---
28
-
29
- # ChatGPT2API 搜索
30
-
31
- 当用户要求联网搜索、查询最新信息、核实资料、查新闻、查价格、查文档更新或需要来源链接时,使用这个 skill。
32
-
33
- ## 接口
34
-
35
- POST ${apiBaseUrl}/v1/search
36
-
37
- Headers:
38
-
39
- Authorization: Bearer ${authKey}
40
- Content-Type: application/json
41
-
42
- Body:
43
-
44
- {
45
- "prompt": "<用户要搜索的问题>"
46
- }
47
-
48
- ## 返回处理
49
-
50
- - 使用接口返回的 \`answer\` 作为主要回答。
51
- - 如果有 \`sources\`,在回答里附上来源链接。
52
- - 如果接口报错,简要说明错误并询问是否重试。`, [apiBaseUrl, authKey]);
53
-
54
- const skillEn = useMemo(() => `---
55
- name: chatgpt2api-search
56
- description: Use when current web search is needed through this chatgpt2api server. Call the configured HTTP search endpoint with a prompt and return the answer with source URLs.
57
- ---
58
-
59
- # ChatGPT2API Search
60
-
61
- Use this skill when the user asks for current web search, online lookup, recent information, or source-backed answers. It calls the local chatgpt2api search endpoint and returns an answer with source links.
62
-
63
- ## When to use
64
-
65
- - The user asks to search the web, look something up, verify current information, or find the latest status.
66
- - The answer needs source URLs, recent details, prices, releases, docs, laws, schedules, or news.
67
- - Do not use it for purely local codebase questions unless the user explicitly asks for web search.
68
-
69
- ## Request
70
-
71
- POST ${apiBaseUrl}/v1/search
72
-
73
- Headers:
74
-
75
- Authorization: Bearer ${authKey}
76
- Content-Type: application/json
77
-
78
- JSON body:
79
-
80
- {
81
- "prompt": "<search question>"
82
- }
83
-
84
- ## Response handling
85
-
86
- - Use \`answer\` as the main response.
87
- - Include source URLs from \`sources\` when available.
88
- - If the endpoint returns an error, summarize the error and ask the user whether to retry.
89
- - Keep the final answer concise unless the user asks for detail.`, [apiBaseUrl, authKey]);
90
-
91
- const zhPrompt = useMemo(() => `请帮我在本机安装一个用于联网搜索的 skill。
92
-
93
- 要求:
94
- 1. 请按你当前环境的 skill 安装规范,把它安装成本地 skill。
95
- 2. skill 名称为:chatgpt2api-search
96
- 3. 文件名为:SKILL.md
97
- 4. 如果你无法确定本地 skills 目录在哪里,先告诉我需要放到哪个目录,不要猜路径。
98
- 5. 只创建或更新这个 skill 文件,不要修改其他无关文件。
99
- 6. SKILL.md 请写入下面的完整内容。
100
-
101
- SKILL.md 内容:
102
-
103
- \`\`\`markdown
104
- ${skillZh}
105
- \`\`\``, [skillZh]);
106
-
107
- const enPrompt = useMemo(() => `Please install a local web-search skill on this machine.
108
-
109
- Requirements:
110
- 1. Install this as a local skill according to the skill installation rules of your current environment.
111
- 2. Skill name: chatgpt2api-search
112
- 3. File name: SKILL.md
113
- 4. If you cannot determine the local skills directory, tell me which directory is required before writing files.
114
- 5. Only create or update this skill file. Do not modify unrelated files.
115
- 6. Write the full content below into SKILL.md.
116
-
117
- SKILL.md content:
118
-
119
- \`\`\`markdown
120
- ${skillEn}
121
- \`\`\``, [skillEn]);
122
-
123
- const copyText = async (text: string) => {
124
- await navigator.clipboard.writeText(text);
125
- toast.success("已复制");
126
- };
127
-
128
- const downloadSkill = (text: string) => {
129
- const url = URL.createObjectURL(new Blob([text], { type: "text/markdown;charset=utf-8" }));
130
- const link = document.createElement("a");
131
- link.href = url;
132
- link.download = "SKILL.md";
133
- link.click();
134
- URL.revokeObjectURL(url);
135
- };
136
-
137
- const versions = [
138
- { title: "中文安装指令", desc: "复制后直接发给 Codex 或 Claude,让它安装到本地。", prompt: zhPrompt, skill: skillZh },
139
- { title: "English install prompt", desc: "Copy and send this to Codex or Claude to install locally.", prompt: enPrompt, skill: skillEn },
140
- ];
141
-
142
- return (
143
- <section className="grid items-stretch gap-4 lg:grid-cols-2">
144
- {versions.map((item) => (
145
- <div key={item.title} className="flex flex-col overflow-hidden rounded-lg border border-slate-200 bg-white shadow-sm dark:border-white/10 dark:bg-white/[0.04]">
146
- <div className="flex items-center justify-between gap-3 border-b border-slate-200/70 bg-slate-50/80 p-4 dark:border-white/10 dark:bg-white/[0.03]">
147
- <div>
148
- <h2 className="font-medium text-slate-900 dark:text-slate-100">{item.title}</h2>
149
- <p className="mt-1 text-sm text-slate-500 dark:text-slate-400">{item.desc}</p>
150
- </div>
151
- <div className="flex gap-2">
152
- <Button size="sm" variant="outline" className="cursor-pointer" onClick={() => downloadSkill(item.skill)}>
153
- <Download />
154
- 下载
155
- </Button>
156
- <Button size="sm" className="cursor-pointer" onClick={() => void copyText(item.prompt)}>
157
- <Copy />
158
- 复制
159
- </Button>
160
- </div>
161
- </div>
162
- <pre className="flex-1 whitespace-pre-wrap p-4 font-mono text-sm leading-6">
163
- {item.prompt}
164
- </pre>
165
- </div>
166
- ))}
167
- </section>
168
- );
169
- }
1
+ "use client";
2
+
3
+ import { useEffect, useMemo, useState } from "react";
4
+ import { Copy, Download } from "lucide-react";
5
+ import { toast } from "sonner";
6
+
7
+ import { Button } from "@/components/ui/button";
8
+ import webConfig from "@/constants/common-env";
9
+ import { fetchSettingsConfig } from "@/lib/api";
10
+ import { getStoredAuthSession } from "@/store/auth";
11
+
12
+ export function SkillPanel() {
13
+ const [browserBaseUrl, setBrowserBaseUrl] = useState("");
14
+ const [configuredBaseUrl, setConfiguredBaseUrl] = useState("");
15
+ const [authKey, setAuthKey] = useState("");
16
+
17
+ useEffect(() => {
18
+ setBrowserBaseUrl(window.location.origin);
19
+ void fetchSettingsConfig().then((data) => setConfiguredBaseUrl(String(data.config.base_url || "").replace(/\/$/, ""))).catch(() => undefined);
20
+ void getStoredAuthSession().then((session) => setAuthKey(session?.key || ""));
21
+ }, []);
22
+
23
+ const apiBaseUrl = configuredBaseUrl || webConfig.apiUrl.replace(/\/$/, "") || browserBaseUrl;
24
+ const skillZh = useMemo(() => `---
25
+ name: chatgpt2api-search
26
+ description: 当用户需要联网搜索、查询最新信息、核实事实或需要来源链接时,调用本地 chatgpt2api 搜索接口。
27
+ ---
28
+
29
+ # ChatGPT2API 搜索
30
+
31
+ 当用户要求联网搜索、查询最新信息、核实资料、查新闻、查价格、查文档更新或需要来源链接时,使用这个 skill。
32
+
33
+ ## 接口
34
+
35
+ POST ${apiBaseUrl}/v1/search
36
+
37
+ Headers:
38
+
39
+ Authorization: Bearer ${authKey}
40
+ Content-Type: application/json
41
+
42
+ Body:
43
+
44
+ {
45
+ "prompt": "<用户要搜索的问题>"
46
+ }
47
+
48
+ ## 返回处理
49
+
50
+ - 使用接口返回的 \`answer\` 作为主要回答。
51
+ - 如果有 \`sources\`,在回答里附上来源链接。
52
+ - 如果接口报错,简要说明错误并询问是否重试。`, [apiBaseUrl, authKey]);
53
+
54
+ const skillEn = useMemo(() => `---
55
+ name: chatgpt2api-search
56
+ description: Use when current web search is needed through this chatgpt2api server. Call the configured HTTP search endpoint with a prompt and return the answer with source URLs.
57
+ ---
58
+
59
+ # ChatGPT2API Search
60
+
61
+ Use this skill when the user asks for current web search, online lookup, recent information, or source-backed answers. It calls the local chatgpt2api search endpoint and returns an answer with source links.
62
+
63
+ ## When to use
64
+
65
+ - The user asks to search the web, look something up, verify current information, or find the latest status.
66
+ - The answer needs source URLs, recent details, prices, releases, docs, laws, schedules, or news.
67
+ - Do not use it for purely local codebase questions unless the user explicitly asks for web search.
68
+
69
+ ## Request
70
+
71
+ POST ${apiBaseUrl}/v1/search
72
+
73
+ Headers:
74
+
75
+ Authorization: Bearer ${authKey}
76
+ Content-Type: application/json
77
+
78
+ JSON body:
79
+
80
+ {
81
+ "prompt": "<search question>"
82
+ }
83
+
84
+ ## Response handling
85
+
86
+ - Use \`answer\` as the main response.
87
+ - Include source URLs from \`sources\` when available.
88
+ - If the endpoint returns an error, summarize the error and ask the user whether to retry.
89
+ - Keep the final answer concise unless the user asks for detail.`, [apiBaseUrl, authKey]);
90
+
91
+ const zhPrompt = useMemo(() => `请帮我在本机安装一个用于联网搜索的 skill。
92
+
93
+ 要求:
94
+ 1. 请按你当前环境的 skill 安装规范,把它安装成本地 skill。
95
+ 2. skill 名称为:chatgpt2api-search
96
+ 3. 文件名为:SKILL.md
97
+ 4. 如果你无法确定本地 skills 目录在哪里,先告诉我需要放到哪个目录,不要猜路径。
98
+ 5. 只创建或更新这个 skill 文件,不要修改其他无关文件。
99
+ 6. SKILL.md 请写入下面的完整内容。
100
+
101
+ SKILL.md 内容:
102
+
103
+ \`\`\`markdown
104
+ ${skillZh}
105
+ \`\`\``, [skillZh]);
106
+
107
+ const enPrompt = useMemo(() => `Please install a local web-search skill on this machine.
108
+
109
+ Requirements:
110
+ 1. Install this as a local skill according to the skill installation rules of your current environment.
111
+ 2. Skill name: chatgpt2api-search
112
+ 3. File name: SKILL.md
113
+ 4. If you cannot determine the local skills directory, tell me which directory is required before writing files.
114
+ 5. Only create or update this skill file. Do not modify unrelated files.
115
+ 6. Write the full content below into SKILL.md.
116
+
117
+ SKILL.md content:
118
+
119
+ \`\`\`markdown
120
+ ${skillEn}
121
+ \`\`\``, [skillEn]);
122
+
123
+ const copyText = async (text: string) => {
124
+ await navigator.clipboard.writeText(text);
125
+ toast.success("已复制");
126
+ };
127
+
128
+ const downloadSkill = (text: string) => {
129
+ const url = URL.createObjectURL(new Blob([text], { type: "text/markdown;charset=utf-8" }));
130
+ const link = document.createElement("a");
131
+ link.href = url;
132
+ link.download = "SKILL.md";
133
+ link.click();
134
+ URL.revokeObjectURL(url);
135
+ };
136
+
137
+ const versions = [
138
+ { title: "中文安装指令", desc: "复制后直接发给 Codex 或 Claude,让它安装到本地。", prompt: zhPrompt, skill: skillZh },
139
+ { title: "English install prompt", desc: "Copy and send this to Codex or Claude to install locally.", prompt: enPrompt, skill: skillEn },
140
+ ];
141
+
142
+ return (
143
+ <section className="grid items-stretch gap-4 lg:grid-cols-2">
144
+ {versions.map((item) => (
145
+ <div key={item.title} className="flex flex-col overflow-hidden rounded-lg border border-slate-200 bg-white shadow-sm dark:border-white/10 dark:bg-white/[0.04]">
146
+ <div className="flex items-center justify-between gap-3 border-b border-slate-200/70 bg-slate-50/80 p-4 dark:border-white/10 dark:bg-white/[0.03]">
147
+ <div>
148
+ <h2 className="font-medium text-slate-900 dark:text-slate-100">{item.title}</h2>
149
+ <p className="mt-1 text-sm text-slate-500 dark:text-slate-400">{item.desc}</p>
150
+ </div>
151
+ <div className="flex gap-2">
152
+ <Button size="sm" variant="outline" className="cursor-pointer" onClick={() => downloadSkill(item.skill)}>
153
+ <Download />
154
+ 下载
155
+ </Button>
156
+ <Button size="sm" className="cursor-pointer" onClick={() => void copyText(item.prompt)}>
157
+ <Copy />
158
+ 复制
159
+ </Button>
160
+ </div>
161
+ </div>
162
+ <pre className="flex-1 whitespace-pre-wrap p-4 font-mono text-sm leading-6">
163
+ {item.prompt}
164
+ </pre>
165
+ </div>
166
+ ))}
167
+ </section>
168
+ );
169
+ }
@@ -1,39 +1,39 @@
1
- export type SearchResult = {
2
- conversation_id: string;
3
- status: string;
4
- answer: string;
5
- sources: Array<{ title?: string; url?: string; snippet?: string; source_type?: string }>;
6
- };
7
-
8
- export type ChatMessage = {
9
- role: "system" | "user" | "assistant";
10
- content: string | ChatContentPart[];
11
- };
12
-
13
- export type ChatContentPart =
14
- | { type: "text"; text: string }
15
- | { type: "image_url"; image_url: { url: string } };
16
-
17
- export type ChatCompletionResponse = {
18
- choices?: Array<{ message?: { role?: string; content?: string } }>;
19
- };
20
-
21
- export type EditableFileTask = {
22
- id: string;
23
- taskId?: string;
24
- status: "queued" | "running" | "success" | "error" | string;
25
- kind: "ppt" | "psd" | string;
26
- created_at?: string;
27
- updated_at?: string;
28
- elapsed_seconds?: number;
29
- polled_at?: number;
30
- prompt_preview?: string;
31
- error?: string;
32
- result?: {
33
- conversation_id?: string;
34
- primary_url?: string;
35
- zip_url?: string;
36
- };
37
- };
38
-
39
- export const pretty = (value: unknown) => JSON.stringify(value, null, 2);
1
+ export type SearchResult = {
2
+ conversation_id: string;
3
+ status: string;
4
+ answer: string;
5
+ sources: Array<{ title?: string; url?: string; snippet?: string; source_type?: string }>;
6
+ };
7
+
8
+ export type ChatMessage = {
9
+ role: "system" | "user" | "assistant";
10
+ content: string | ChatContentPart[];
11
+ };
12
+
13
+ export type ChatContentPart =
14
+ | { type: "text"; text: string }
15
+ | { type: "image_url"; image_url: { url: string } };
16
+
17
+ export type ChatCompletionResponse = {
18
+ choices?: Array<{ message?: { role?: string; content?: string } }>;
19
+ };
20
+
21
+ export type EditableFileTask = {
22
+ id: string;
23
+ taskId?: string;
24
+ status: "queued" | "running" | "success" | "error" | string;
25
+ kind: "ppt" | "psd" | string;
26
+ created_at?: string;
27
+ updated_at?: string;
28
+ elapsed_seconds?: number;
29
+ polled_at?: number;
30
+ prompt_preview?: string;
31
+ error?: string;
32
+ result?: {
33
+ conversation_id?: string;
34
+ primary_url?: string;
35
+ zip_url?: string;
36
+ };
37
+ };
38
+
39
+ export const pretty = (value: unknown) => JSON.stringify(value, null, 2);
@@ -1,59 +1,59 @@
1
- "use client";
2
-
3
- import { LoaderCircle } from "lucide-react";
4
-
5
- import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
6
- import { useAuthGuard } from "@/lib/use-auth-guard";
7
-
8
- import { ChatPanel } from "./components/chat-panel";
9
- import { PptPanel } from "./components/ppt-panel";
10
- import { PsdPanel } from "./components/psd-panel";
11
- import { SearchPanel } from "./components/search-panel";
12
- import { SkillPanel } from "./components/skill-panel";
13
-
14
- const tabs = [
15
- { value: "skills", title: "搜索Skills" },
16
- { value: "search", title: "搜索" },
17
- { value: "ppt", title: "PPT生成" },
18
- { value: "psd", title: "PSD生成" },
19
- { value: "chat", title: "对话" },
20
- ];
21
-
22
- export default function DebugPage() {
23
- const { isCheckingAuth, session } = useAuthGuard(["admin"]);
24
-
25
- if (isCheckingAuth || !session || session.role !== "admin") {
26
- return (
27
- <div className="flex min-h-[calc(100vh-49px)] items-center justify-center">
28
- <LoaderCircle className="size-5 animate-spin text-muted-foreground" />
29
- </div>
30
- );
31
- }
32
-
33
- return (
34
- <Tabs defaultValue="skills" className="mx-auto flex min-h-[calc(100vh-49px)] w-full max-w-[1600px] flex-col gap-4 px-4 pt-3 pb-6 md:px-8">
35
- <TabsList variant="line" className="w-full">
36
- {tabs.map(({ value, title }) => (
37
- <TabsTrigger key={value} value={value}>
38
- {title}
39
- </TabsTrigger>
40
- ))}
41
- </TabsList>
42
- <TabsContent value="skills">
43
- <SkillPanel />
44
- </TabsContent>
45
- <TabsContent value="search" className="min-h-0">
46
- <SearchPanel />
47
- </TabsContent>
48
- <TabsContent value="ppt" className="min-h-0">
49
- <PptPanel />
50
- </TabsContent>
51
- <TabsContent value="psd" className="min-h-0">
52
- <PsdPanel />
53
- </TabsContent>
54
- <TabsContent value="chat" className="min-h-0">
55
- <ChatPanel />
56
- </TabsContent>
57
- </Tabs>
58
- );
59
- }
1
+ "use client";
2
+
3
+ import { LoaderCircle } from "lucide-react";
4
+
5
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
6
+ import { useAuthGuard } from "@/lib/use-auth-guard";
7
+
8
+ import { ChatPanel } from "./components/chat-panel";
9
+ import { PptPanel } from "./components/ppt-panel";
10
+ import { PsdPanel } from "./components/psd-panel";
11
+ import { SearchPanel } from "./components/search-panel";
12
+ import { SkillPanel } from "./components/skill-panel";
13
+
14
+ const tabs = [
15
+ { value: "skills", title: "搜索Skills" },
16
+ { value: "search", title: "搜索" },
17
+ { value: "ppt", title: "PPT生成" },
18
+ { value: "psd", title: "PSD生成" },
19
+ { value: "chat", title: "对话" },
20
+ ];
21
+
22
+ export default function DebugPage() {
23
+ const { isCheckingAuth, session } = useAuthGuard(["admin"]);
24
+
25
+ if (isCheckingAuth || !session || session.role !== "admin") {
26
+ return (
27
+ <div className="flex min-h-[calc(100vh-49px)] items-center justify-center">
28
+ <LoaderCircle className="size-5 animate-spin text-muted-foreground" />
29
+ </div>
30
+ );
31
+ }
32
+
33
+ return (
34
+ <Tabs defaultValue="skills" className="mx-auto flex min-h-[calc(100vh-49px)] w-full max-w-[1600px] flex-col gap-4 px-4 pt-3 pb-6 md:px-8">
35
+ <TabsList variant="line" className="w-full">
36
+ {tabs.map(({ value, title }) => (
37
+ <TabsTrigger key={value} value={value}>
38
+ {title}
39
+ </TabsTrigger>
40
+ ))}
41
+ </TabsList>
42
+ <TabsContent value="skills">
43
+ <SkillPanel />
44
+ </TabsContent>
45
+ <TabsContent value="search" className="min-h-0">
46
+ <SearchPanel />
47
+ </TabsContent>
48
+ <TabsContent value="ppt" className="min-h-0">
49
+ <PptPanel />
50
+ </TabsContent>
51
+ <TabsContent value="psd" className="min-h-0">
52
+ <PsdPanel />
53
+ </TabsContent>
54
+ <TabsContent value="chat" className="min-h-0">
55
+ <ChatPanel />
56
+ </TabsContent>
57
+ </Tabs>
58
+ );
59
+ }