ai4scholar 0.6.6 → 0.6.7

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 +16 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -24823,19 +24823,19 @@ function createSciDrawTool() {
24823
24823
  return {
24824
24824
  label: "Scientific Drawing",
24825
24825
  name: "sci_draw",
24826
- description: "Generate or process scientific figures using AI. IMPORTANT: Image generation takes 30-60 seconds. You MUST tell the user '\u6B63\u5728\u751F\u6210\u79D1\u7814\u56FE\u7247\uFF0C\u5927\u7EA6\u9700\u8981 30-60 \u79D2\uFF0C\u8BF7\u7A0D\u5019...' BEFORE calling this tool, so the user knows to wait. Actions: 'smart' (auto-optimize prompt, supports Chinese, recommended), 'generate' (text-to-image), 'edit' (modify existing image), 'style' (style transfer), 'compose' (combine multiple images), 'iterate' (auto-review and refine), 'critic' (expert review, returns text), 'svg' (generate SVG vector graphics). Models: 'flash' (fast), 'flash31' (balanced, default), 'pro' (high quality). Returns image URL or SVG code. After receiving the result, display the imageUrl as an image to the user.",
24826
+ description: "Generate or process scientific figures using AI. IMPORTANT: Image generation takes 30-60 seconds. You MUST tell the user '\u6B63\u5728\u751F\u6210\u79D1\u7814\u56FE\u7247\uFF0C\u5927\u7EA6\u9700\u8981 30-60 \u79D2\uFF0C\u8BF7\u7A0D\u5019...' BEFORE calling this tool, so the user knows to wait. Actions: 'smart' (auto-optimize prompt, supports Chinese, recommended), 'generate' (text-to-image), 'edit' (modify existing image), 'style' (style transfer), 'compose' (combine multiple images), 'iterate' (auto-review and refine), 'critic' (expert review, returns text), 'svg' (generate SVG vector graphics), 'vectorize' (convert PNG/JPG to PDF+PPTX vector format). Models: 'flash' (fast), 'flash31' (balanced, default), 'pro' (high quality), 'gptimage' (GPT Image 2, best for detailed illustrations, promo price 2 credits). Returns image URL or download links. After receiving the result, display the imageUrl as an image to the user.",
24827
24827
  parameters: Type.Object({
24828
24828
  action: Type.String({
24829
- description: "Operation type: 'smart', 'generate', 'edit', 'style', 'compose', 'iterate', 'critic', 'svg'",
24830
- enum: ["smart", "generate", "edit", "style", "compose", "iterate", "critic", "svg"]
24829
+ description: "Operation type: 'smart', 'generate', 'edit', 'style', 'compose', 'iterate', 'critic', 'svg', 'vectorize'",
24830
+ enum: ["smart", "generate", "edit", "style", "compose", "iterate", "critic", "svg", "vectorize"]
24831
24831
  }),
24832
24832
  prompt: Type.String({
24833
- description: "Description or instruction for the image. Can be empty for 'critic' action. Supports Chinese in 'smart' mode."
24833
+ description: "Description or instruction for the image. Can be empty for 'critic' and 'vectorize' actions. Supports Chinese in 'smart' mode."
24834
24834
  }),
24835
24835
  model: Type.Optional(
24836
24836
  Type.String({
24837
- description: "Model: 'flash' (fast), 'flash31' (balanced, default), 'pro' (high quality)",
24838
- enum: ["flash", "flash31", "pro"]
24837
+ description: "Model: 'flash' (fast), 'flash31' (balanced, default), 'pro' (high quality), 'gptimage' (GPT Image 2, promo 2 credits)",
24838
+ enum: ["flash", "flash31", "pro", "gptimage"]
24839
24839
  })
24840
24840
  ),
24841
24841
  imageSize: Type.Optional(
@@ -24862,12 +24862,18 @@ function createSciDrawTool() {
24862
24862
  description: "Language: 'en' (default), 'zh'",
24863
24863
  enum: ["en", "zh"]
24864
24864
  })
24865
+ ),
24866
+ vectorizeMode: Type.Optional(
24867
+ Type.String({
24868
+ description: "Vectorize quality: 'fast' (default), 'standard', 'premium'. Only for 'vectorize' action.",
24869
+ enum: ["fast", "standard", "premium"]
24870
+ })
24865
24871
  )
24866
24872
  }),
24867
24873
  execute: async (_id, raw) => {
24868
24874
  let p = raw, apiKey = getApiKey();
24869
24875
  if (!apiKey) return Result.err("no_api_key", "API key not configured");
24870
- let action = readString(p, "action", { required: !0 }), prompt = readString(p, "prompt") ?? "", needsImages = ["edit", "style", "compose", "iterate", "critic"], images = p.images;
24876
+ let action = readString(p, "action", { required: !0 }), prompt = readString(p, "prompt") ?? "", needsImages = ["edit", "style", "compose", "iterate", "critic", "vectorize"], images = p.images;
24871
24877
  if (needsImages.includes(action) && (!images || images.length === 0))
24872
24878
  return Result.err("missing_images", `Action '${action}' requires at least one image in the 'images' parameter`);
24873
24879
  if (action === "compose" && images && images.length < 2)
@@ -24882,6 +24888,8 @@ function createSciDrawTool() {
24882
24888
  stylePreset && (body.stylePreset = stylePreset);
24883
24889
  let lang = readString(p, "lang");
24884
24890
  lang && (body.lang = lang);
24891
+ let vectorizeMode = readString(p, "vectorizeMode");
24892
+ vectorizeMode && action === "vectorize" && (body.vectorizeMode = vectorizeMode);
24885
24893
  try {
24886
24894
  let res = await fetch(`${BASE_URL2}/api/proxy/nano/generate`, {
24887
24895
  method: "POST",
@@ -24901,7 +24909,7 @@ function createSciDrawTool() {
24901
24909
  if (!data.success)
24902
24910
  return Result.err("generation_failed", "Image generation failed. Credits have been refunded automatically.");
24903
24911
  let result = { action };
24904
- return data.imageUrl ? result.imageUrl = data.imageUrl : action !== "critic" && action !== "svg" && (result.warning = "Image was generated but imageUrl is empty. This may be a transient issue \u2014 please retry."), data.svgCode && (result.svgCode = data.svgCode), data.svgUrl && (result.svgUrl = data.svgUrl), data.optimizedPrompt && (result.optimizedPrompt = data.optimizedPrompt), data.critique && (result.critique = data.critique), data.creditCost !== void 0 && (result.creditCost = data.creditCost), Result.ok(result);
24912
+ return data.imageUrl ? result.imageUrl = data.imageUrl : action !== "critic" && action !== "svg" && action !== "vectorize" && (result.warning = "Image was generated but imageUrl is empty. This may be a transient issue \u2014 please retry."), data.svgCode && (result.svgCode = data.svgCode), data.svgUrl && (result.svgUrl = data.svgUrl), data.pdfUrl && (result.pdfUrl = data.pdfUrl), data.pptxUrl && (result.pptxUrl = data.pptxUrl), data.optimizedPrompt && (result.optimizedPrompt = data.optimizedPrompt), data.critique && (result.critique = data.critique), data.creditCost !== void 0 && (result.creditCost = data.creditCost), Result.ok(result);
24905
24913
  } catch (e) {
24906
24914
  return Result.err("request_failed", e instanceof Error ? e.message : String(e));
24907
24915
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai4scholar",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "description": "Multi-source academic literature search, management, and analysis plugin for OpenClaw. Powered by ai4scholar.net.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",