@easy-cms/plugin-ai 1.32.0 → 1.34.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.
Files changed (2) hide show
  1. package/dist/index.js +39 -3
  2. package/package.json +5 -4
package/dist/index.js CHANGED
@@ -6,13 +6,43 @@ var INFO = {
6
6
  name: "@easy-cms/plugin-ai",
7
7
  // The plugin API it is written for (`PLUGIN_API_VERSION` of @easy-cms/core).
8
8
  apiVersion: 1,
9
- ...true ? { version: "1.32.0" } : {}
9
+ ...true ? { version: "1.34.0" } : {}
10
10
  };
11
11
 
12
12
  // src/providers.ts
13
13
  import {
14
14
  AiProviderError
15
15
  } from "@easy-cms/core";
16
+
17
+ // ../../node_modules/.pnpm/simple-icons@16.36.0/node_modules/simple-icons/index.mjs
18
+ var c = '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>';
19
+ var t = '</title><path d="';
20
+ var a = '"/></svg>';
21
+ var siAnthropic = { title: "Anthropic", slug: "anthropic", get svg() {
22
+ return c + "Anthropic" + t + this.path + a;
23
+ }, path: "M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z", source: "https://www.anthropic.com", hex: "191919" };
24
+ var siGooglegemini = { title: "Google Gemini", slug: "googlegemini", get svg() {
25
+ return c + "Google Gemini" + t + this.path + a;
26
+ }, path: "M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81", source: "https://gemini.google.com", hex: "8E75B2" };
27
+
28
+ // src/logos.ts
29
+ var simple = (icon) => ({
30
+ paths: [{ d: icon.path }],
31
+ color: `#${icon.hex}`
32
+ });
33
+ var anthropicLogo = simple(siAnthropic);
34
+ var geminiLogo = simple(siGooglegemini);
35
+ var openaiLogo = {
36
+ viewBox: "0 0 256 260",
37
+ paths: [
38
+ {
39
+ d: "M239.184 106.203a64.72 64.72 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.72 64.72 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.67 64.67 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.77 64.77 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483m-97.56 136.338a48.4 48.4 0 0 1-31.105-11.255l1.535-.87l51.67-29.825a8.6 8.6 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601M37.158 197.93a48.35 48.35 0 0 1-5.781-32.589l1.534.921l51.722 29.826a8.34 8.34 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803M23.549 85.38a48.5 48.5 0 0 1 25.58-21.333v61.39a8.29 8.29 0 0 0 4.195 7.316l62.874 36.272l-21.845 12.636a.82.82 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405zm179.466 41.695l-63.08-36.63L161.73 77.86a.82.82 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.54 8.54 0 0 0-4.4-7.213m21.742-32.69l-1.535-.922l-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.72.72 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391zM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87l-51.67 29.825a8.6 8.6 0 0 0-4.246 7.367zm11.868-25.58L128.067 97.3l28.188 16.218v32.434l-28.086 16.218l-28.188-16.218z"
40
+ }
41
+ ],
42
+ color: "#000000"
43
+ };
44
+
45
+ // src/providers.ts
16
46
  var trim = (url) => url.replace(/\/+$/, "");
17
47
  async function request(url, init) {
18
48
  let response;
@@ -87,6 +117,7 @@ var anthropic = {
87
117
  id: "anthropic",
88
118
  label: "Anthropic (Claude)",
89
119
  category: "ai",
120
+ icon: anthropicLogo,
90
121
  description: { en: "Claude models", th: "model Claude" },
91
122
  plugin: "@easy-cms/plugin-ai",
92
123
  docs: "https://easycms.dev/docs/ai",
@@ -123,7 +154,7 @@ var anthropic = {
123
154
  const content = body.content ?? [];
124
155
  const usage = body.usage ?? {};
125
156
  return {
126
- text: content.filter((c) => c.type === "text").map((c) => c.text ?? "").join(""),
157
+ text: content.filter((c2) => c2.type === "text").map((c2) => c2.text ?? "").join(""),
127
158
  usage: { input: usage.input_tokens ?? 0, output: usage.output_tokens ?? 0 }
128
159
  };
129
160
  }
@@ -135,7 +166,7 @@ function openAiCompatible(options) {
135
166
  });
136
167
  const models = async (values) => {
137
168
  const body = await request(`${options.base(values)}/models`, { headers: headers(values) });
138
- return (body.data ?? []).map((m) => ({ value: m.id, label: m.id })).sort((a, b) => a.value.localeCompare(b.value));
169
+ return (body.data ?? []).map((m) => ({ value: m.id, label: m.id })).sort((a2, b) => a2.value.localeCompare(b.value));
139
170
  };
140
171
  return {
141
172
  ...options.defaultModel ? { defaultModel: options.defaultModel } : {},
@@ -143,6 +174,7 @@ function openAiCompatible(options) {
143
174
  id: options.id,
144
175
  label: options.label,
145
176
  category: "ai",
177
+ icon: options.icon,
146
178
  description: options.description,
147
179
  plugin: "@easy-cms/plugin-ai",
148
180
  docs: "https://easycms.dev/docs/ai",
@@ -186,6 +218,7 @@ function openAiCompatible(options) {
186
218
  var openai = openAiCompatible({
187
219
  id: "openai",
188
220
  label: "OpenAI (GPT)",
221
+ icon: openaiLogo,
189
222
  description: { en: "GPT models", th: "model GPT" },
190
223
  base: () => trim(process.env.OPENAI_API_URL ?? "https://api.openai.com/v1"),
191
224
  defaultModel: "gpt-5-mini",
@@ -197,6 +230,8 @@ var openai = openAiCompatible({
197
230
  var openaiCompatible = openAiCompatible({
198
231
  id: "openai-compatible",
199
232
  label: "OpenAI-compatible",
233
+ // A server of your own: no one brand's logo.
234
+ icon: "globe",
200
235
  description: {
201
236
  en: "Ollama, OpenRouter or another server with an OpenAI-style API",
202
237
  th: "Ollama, OpenRouter \u0E2B\u0E23\u0E37\u0E2D\u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C\u0E2D\u0E37\u0E48\u0E19\u0E17\u0E35\u0E48\u0E21\u0E35 API \u0E41\u0E1A\u0E1A OpenAI"
@@ -245,6 +280,7 @@ var gemini = {
245
280
  id: "gemini",
246
281
  label: "Google Gemini",
247
282
  category: "ai",
283
+ icon: geminiLogo,
248
284
  description: { en: "Gemini models", th: "model Gemini" },
249
285
  plugin: "@easy-cms/plugin-ai",
250
286
  docs: "https://easycms.dev/docs/ai",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easy-cms/plugin-ai",
3
- "version": "1.32.0",
3
+ "version": "1.34.0",
4
4
  "description": "AI for Easy CMS: connect Claude, GPT, Gemini or an OpenAI-compatible provider on the Integrations page, for the admin's AI features",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -16,11 +16,12 @@
16
16
  "dist"
17
17
  ],
18
18
  "peerDependencies": {
19
- "@easy-cms/core": "^1.32.0"
19
+ "@easy-cms/core": "^1.34.0"
20
20
  },
21
21
  "devDependencies": {
22
- "@easy-cms/core": "^1.32.0",
23
- "@easy-cms/db-sqlite": "^1.32.0"
22
+ "simple-icons": "16.36.0",
23
+ "@easy-cms/core": "^1.34.0",
24
+ "@easy-cms/db-sqlite": "^1.34.0"
24
25
  },
25
26
  "engines": {
26
27
  "node": ">=22.12"