ai4scholar 0.3.3 → 0.4.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/README.md CHANGED
@@ -6,7 +6,7 @@ Powered by [ai4scholar.net](https://ai4scholar.net).
6
6
 
7
7
  ## What It Does
8
8
 
9
- AI4Scholar gives your OpenClaw agent direct access to **6 academic platforms** through **35 built-in tools**, plus 2 agent skills for literature surveys and automatic citation annotation.
9
+ AI4Scholar gives your OpenClaw agent direct access to **6 academic platforms** through **37 built-in tools**, plus a literature survey skill for comprehensive report generation.
10
10
 
11
11
  ### Platforms
12
12
 
@@ -19,7 +19,7 @@ AI4Scholar gives your OpenClaw agent direct access to **6 academic platforms** t
19
19
  | **bioRxiv** | Biology preprints |
20
20
  | **medRxiv** | Health sciences preprints |
21
21
 
22
- ### Tools (35)
22
+ ### Tools (37)
23
23
 
24
24
  **Search (9)**
25
25
 
@@ -91,12 +91,23 @@ AI4Scholar gives your OpenClaw agent direct access to **6 academic platforms** t
91
91
  |------|-------------|
92
92
  | `paper_quality_rank` | Rank papers by CCF classification, citations, year, h-index |
93
93
 
94
+ **Auto-Citation (1)**
95
+
96
+ | Tool | Description |
97
+ |------|-------------|
98
+ | `auto_cite` | One-click citation annotation: add real references to academic text (IEEE/APA/Vancouver/Nature styles) |
99
+
100
+ **Scientific Drawing (1)**
101
+
102
+ | Tool | Description |
103
+ |------|-------------|
104
+ | `sci_draw` | AI-powered scientific figure generation (text-to-image, edit, style transfer, SVG, critique) |
105
+
94
106
  ### Skills
95
107
 
96
108
  | Skill | Description |
97
109
  |-------|-------------|
98
110
  | **literature-survey** | Multi-source literature survey with HTML report generation |
99
- | **auto-cite** | Automatically add citation markers and reference list to academic text |
100
111
 
101
112
  ### Slash Commands
102
113
 
@@ -156,7 +167,7 @@ Set your API key in `openclaw.json`:
156
167
  }
157
168
  ```
158
169
 
159
- Get your API key at [ai4scholar.net/dashboard](https://ai4scholar.net/dashboard?view=api-keys).
170
+ Get your API key at [ai4scholar.net](https://ai4scholar.net?src=openclaw).
160
171
 
161
172
  ## Usage
162
173
 
@@ -194,6 +205,8 @@ ai4scholar/
194
205
  │ │ ├── biorxiv.ts # 6 bioRxiv/medRxiv tools
195
206
  │ │ ├── doi-download.ts # 2 DOI-based download tools
196
207
  │ │ ├── quality-rank.ts # Paper quality ranking (CCF)
208
+ │ │ ├── auto-cite.ts # Auto-citation via ai4scholar API
209
+ │ │ ├── sci-draw.ts # Scientific figure generation
197
210
  │ │ ├── pdf-utils.ts # PDF download & text extraction
198
211
  │ │ ├── result.ts # Tool result helpers
199
212
  │ │ └── params.ts # Parameter parsing
@@ -204,9 +217,7 @@ ai4scholar/
204
217
  ├── scripts/ # Python helpers (HTML reports)
205
218
  ├── assets/ # Report templates
206
219
  ├── skills/
207
- ├── literature-survey/
208
- │ │ └── SKILL.md
209
- │ └── auto-cite/
220
+ └── literature-survey/
210
221
  │ └── SKILL.md
211
222
  ├── data/
212
223
  │ └── ccf_2022.jsonl # CCF ranking data
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAgDlD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,GAAG,EAAE,iBAAiB,QA4FtD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAkDlD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,GAAG,EAAE,iBAAiB,QAqGtD"}
package/dist/index.js CHANGED
@@ -8,6 +8,8 @@ import { createArxivSearchTool, createArxivDownloadTool, createArxivReadTool } f
8
8
  import { createBiorxivSearchTool, createMedrxivSearchTool, createBiorxivDownloadTool, createMedrxivDownloadTool, createBiorxivReadTool, createMedrxivReadTool, } from "./src/tools/biorxiv.js";
9
9
  import { createDoiDownloadTool, createDoiReadTool } from "./src/tools/doi-download.js";
10
10
  import { createPaperQualityRankTool } from "./src/tools/quality-rank.js";
11
+ import { createAutoCiteTool } from "./src/tools/auto-cite.js";
12
+ import { createSciDrawTool } from "./src/tools/sci-draw.js";
11
13
  import { handleLibrary, handleProjects, handleReadingList, } from "./src/commands.js";
12
14
  import { createScholarModeHook } from "./src/hooks/scholar-mode.js";
13
15
  export default function register(api) {
@@ -16,7 +18,10 @@ export default function register(api) {
16
18
  setApiKey(cfg.apiKey);
17
19
  }
18
20
  else {
19
- api.logger.warn("AI4Scholar: no apiKey configured. Semantic Scholar, PubMed, and Google Scholar tools require an API key from ai4scholar.net.");
21
+ api.logger.warn(`AI4Scholar: apiKey 未配置。请在 openclaw.json plugins.entries.ai4scholar 中添加:
22
+ "config": { "apiKey": "<your-key>" }
23
+ 获取 API Key → https://ai4scholar.net?src=openclaw
24
+ 配置后重启 Gateway 生效。arXiv / bioRxiv / medRxiv 工具无需 Key 即可使用。`);
20
25
  }
21
26
  // --- Semantic Scholar (17 tools) ---
22
27
  api.registerTool(createSemanticSearchTool());
@@ -60,6 +65,10 @@ export default function register(api) {
60
65
  api.registerTool(createDoiReadTool());
61
66
  // --- Quality evaluation (1 tool) ---
62
67
  api.registerTool(createPaperQualityRankTool());
68
+ // --- Auto-cite (1 tool) ---
69
+ api.registerTool(createAutoCiteTool());
70
+ // --- Scientific drawing (1 tool) ---
71
+ api.registerTool(createSciDrawTool());
63
72
  // --- Slash commands ---
64
73
  api.registerCommand({
65
74
  name: "library",
@@ -85,6 +94,6 @@ export default function register(api) {
85
94
  // --- Hooks ---
86
95
  api.on("before_prompt_build", createScholarModeHook(), { priority: 100 });
87
96
  api.on("before_tool_call", createSkillInjectionHook(path.dirname(api.source)));
88
- api.logger.info(`AI4Scholar plugin loaded — 35 tools registered (apiKey: ${cfg?.apiKey ? "configured" : "missing"})`);
97
+ api.logger.info(`AI4Scholar plugin loaded — 37 tools registered (apiKey: ${cfg?.apiKey ? "configured" : "missing"})`);
89
98
  }
90
99
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,2BAA2B,EAC3B,4BAA4B,EAC5B,8BAA8B,EAC9B,8BAA8B,EAC9B,iCAAiC,EACjC,yCAAyC,EACzC,+BAA+B,EAC/B,8BAA8B,EAC9B,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,8BAA8B,EAC9B,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3G,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,MAAM,CAA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K;QAClB,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;IAEH,GAAG,CAAC,eAAe,CAAC;QAClB,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,8CAA8C;QAC3D,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,iBAAiB;KAC3B,CAAC,CAAC;IAEH,gBAAgB;IAChB,GAAG,CAAC,EAAE,CAAC,qBAAqB,EAAE,qBAAqB,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1E,GAAG,CAAC,EAAE,CAAC,kBAAkB,EAAE,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAE/E,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,2DAA2D,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,GAAG,CACrG,CAAC;AACJ,CAAC"}
@@ -1,4 +1,4 @@
1
- const SCHOLAR_MODE_PROMPT = `[AI4Scholar] You have 35 academic literature tools covering Semantic Scholar, PubMed, Google Scholar, arXiv, bioRxiv, and medRxiv. Capabilities include: search, paper detail, citations, references, author lookup, recommendations, snippet search, batch queries, title matching, bulk search, PDF download, full-text reading, direct DOI-based paper download (leverages institutional access when available), and paper quality ranking (CCF classification). For paper search or literature questions, call the tools directly and respond in Markdown. When the user pastes academic text and asks to add citations/references, read the auto-cite SKILL.md. Only read the literature-survey SKILL.md when the user explicitly requests an HTML report or a comprehensive multi-source survey.`;
1
+ const SCHOLAR_MODE_PROMPT = `[AI4Scholar] You have 37 academic tools covering Semantic Scholar, PubMed, Google Scholar, arXiv, bioRxiv, and medRxiv. Capabilities: search, paper detail, citations, references, author lookup, recommendations, snippet search, batch queries, title matching, bulk search, PDF download, full-text reading, DOI-based paper download (institutional access), paper quality ranking (CCF), auto-citation (auto_cite tool), and scientific figure generation (sci_draw tool). For paper search or literature questions, call the search tools directly and respond in Markdown. When the user pastes academic text and asks to add citations/references, call the auto_cite tool directly. When the user asks to create scientific figures or diagrams, call the sci_draw tool. Only read the literature-survey SKILL.md when the user explicitly requests an HTML report or a comprehensive multi-source survey.`;
2
2
  export function createScholarModeHook() {
3
3
  return (event, _context) => {
4
4
  if (!event.messages || event.messages.length === 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"scholar-mode.js","sourceRoot":"","sources":["../../../src/hooks/scholar-mode.ts"],"names":[],"mappings":"AAgBA,MAAM,mBAAmB,GAAG,wwBAAwwB,CAAC;AAEryB,MAAM,UAAU,qBAAqB;IACnC,OAAO,CAAC,KAAgB,EAAE,QAAqB,EAAc,EAAE;QAC7D,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC;QACjD,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"scholar-mode.js","sourceRoot":"","sources":["../../../src/hooks/scholar-mode.ts"],"names":[],"mappings":"AAgBA,MAAM,mBAAmB,GAAG,q3BAAq3B,CAAC;AAEl5B,MAAM,UAAU,qBAAqB;IACnC,OAAO,CAAC,KAAgB,EAAE,QAAqB,EAAc,EAAE;QAC7D,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC;QACjD,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,24 @@
1
+ export declare function createAutoCiteTool(): {
2
+ label: string;
3
+ name: string;
4
+ description: string;
5
+ parameters: import("@sinclair/typebox").TObject<{
6
+ text: import("@sinclair/typebox").TString;
7
+ mode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
8
+ minCitations: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
9
+ field: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
10
+ yearPreference: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
11
+ excludePreprints: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
12
+ excludeConferences: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
13
+ citationStyle: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
14
+ }>;
15
+ execute: (_id: string, raw: unknown) => Promise<{
16
+ type: "tool_result";
17
+ content: {
18
+ type: "text";
19
+ text: string;
20
+ }[];
21
+ isError?: boolean;
22
+ }>;
23
+ };
24
+ //# sourceMappingURL=auto-cite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-cite.d.ts","sourceRoot":"","sources":["../../../src/tools/auto-cite.ts"],"names":[],"mappings":"AA8FA,wBAAgB,kBAAkB;;;;;;;;;;;;;;mBA0CT,MAAM,OAAO,OAAO;;;;;;;;EAsC5C"}
@@ -0,0 +1,137 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { getApiKey } from "./api-client.js";
3
+ import { readString, readNumber } from "./params.js";
4
+ import { Result } from "./result.js";
5
+ const BASE_URL = "https://ai4scholar.net";
6
+ const TIMEOUT_MS = 300_000;
7
+ async function callAutoCiteApi(body) {
8
+ const apiKey = getApiKey();
9
+ if (!apiKey)
10
+ return { ok: false, error: "API key not configured" };
11
+ const res = await fetch(`${BASE_URL}/api/proxy/auto-cite`, {
12
+ method: "POST",
13
+ headers: {
14
+ Authorization: `Bearer ${apiKey}`,
15
+ "Content-Type": "application/json",
16
+ "User-Agent": "ai4scholar-openclaw/0.3",
17
+ },
18
+ body: JSON.stringify(body),
19
+ signal: AbortSignal.timeout(TIMEOUT_MS),
20
+ });
21
+ if (!res.ok) {
22
+ const text = await res.text().catch(() => "");
23
+ return { ok: false, error: `HTTP ${res.status}: ${text}` };
24
+ }
25
+ const reader = res.body?.getReader();
26
+ if (!reader)
27
+ return { ok: false, error: "No response body" };
28
+ const decoder = new TextDecoder();
29
+ let buffer = "";
30
+ let result = null;
31
+ let lastError = null;
32
+ while (true) {
33
+ const { done, value } = await reader.read();
34
+ if (done)
35
+ break;
36
+ buffer += decoder.decode(value, { stream: true });
37
+ const lines = buffer.split("\n");
38
+ buffer = lines.pop() || "";
39
+ let currentEvent = "";
40
+ for (const line of lines) {
41
+ if (line.startsWith("event: ")) {
42
+ currentEvent = line.slice(7).trim();
43
+ }
44
+ else if (line.startsWith("data: ")) {
45
+ try {
46
+ const data = JSON.parse(line.slice(6));
47
+ if (currentEvent === "result") {
48
+ result = data;
49
+ }
50
+ else if (currentEvent === "error") {
51
+ lastError = data.message || "Processing error";
52
+ }
53
+ }
54
+ catch {
55
+ // skip malformed JSON
56
+ }
57
+ }
58
+ }
59
+ }
60
+ if (result)
61
+ return { ok: true, data: result };
62
+ return { ok: false, error: lastError || "No result received from auto-cite API" };
63
+ }
64
+ export function createAutoCiteTool() {
65
+ return {
66
+ label: "Auto-Cite Academic Text",
67
+ name: "auto_cite",
68
+ description: "Automatically add real citations to academic text. Analyzes the text, searches matching papers from Semantic Scholar / PubMed / Google Scholar, and inserts citation markers [1], [2] with a formatted reference list. Supports IEEE, APA, Vancouver, Nature, and numbered citation styles. Returns annotated text + references + BibTeX. Processing takes 20-60 seconds.",
69
+ parameters: Type.Object({
70
+ text: Type.String({
71
+ description: "Academic text to annotate with citations (100-10000 characters)",
72
+ }),
73
+ mode: Type.Optional(Type.String({
74
+ description: "'auto' (detect citation locations, default) or 'manual' (use [CITE] markers in text)",
75
+ enum: ["auto", "manual"],
76
+ })),
77
+ minCitations: Type.Optional(Type.Number({
78
+ description: "Minimum number of citations to add in auto mode (default 10)",
79
+ minimum: 1,
80
+ maximum: 50,
81
+ })),
82
+ field: Type.Optional(Type.String({ description: "Academic field for search optimization (e.g. 'computer science', 'biology')" })),
83
+ yearPreference: Type.Optional(Type.Number({ description: "Preferred publication year for cited papers (e.g. 2024)" })),
84
+ excludePreprints: Type.Optional(Type.Boolean({ description: "Exclude preprints from citations (default false)" })),
85
+ excludeConferences: Type.Optional(Type.Boolean({ description: "Exclude conference papers from citations (default false)" })),
86
+ citationStyle: Type.Optional(Type.String({
87
+ description: "Citation format: 'ieee' (default), 'apa', 'vancouver', 'nature', 'numbered'",
88
+ enum: ["ieee", "apa", "vancouver", "nature", "numbered"],
89
+ })),
90
+ }),
91
+ execute: async (_id, raw) => {
92
+ const p = raw;
93
+ const text = readString(p, "text", { required: true });
94
+ if (text.length < 100)
95
+ return Result.err("text_too_short", "Text must be at least 100 characters");
96
+ if (text.length > 10000)
97
+ return Result.err("text_too_long", "Text must be at most 10000 characters");
98
+ const body = { text };
99
+ const mode = readString(p, "mode");
100
+ if (mode)
101
+ body.mode = mode;
102
+ const minCitations = readNumber(p, "minCitations");
103
+ if (minCitations !== undefined)
104
+ body.minCitations = minCitations;
105
+ const field = readString(p, "field");
106
+ if (field)
107
+ body.field = field;
108
+ const yearPref = readNumber(p, "yearPreference");
109
+ if (yearPref !== undefined)
110
+ body.yearPreference = yearPref;
111
+ if (p.excludePreprints !== undefined)
112
+ body.excludePreprints = p.excludePreprints;
113
+ if (p.excludeConferences !== undefined)
114
+ body.excludeConferences = p.excludeConferences;
115
+ const style = readString(p, "citationStyle");
116
+ if (style)
117
+ body.citationStyle = style;
118
+ try {
119
+ const res = await callAutoCiteApi(body);
120
+ if (!res.ok)
121
+ return Result.err("api_error", res.error);
122
+ const { annotatedText, references, bibtex, stats } = res.data;
123
+ return Result.ok({
124
+ annotatedText,
125
+ referenceCount: references.length,
126
+ references,
127
+ bibtex: bibtex || "",
128
+ stats,
129
+ });
130
+ }
131
+ catch (e) {
132
+ return Result.err("request_failed", e instanceof Error ? e.message : String(e));
133
+ }
134
+ },
135
+ };
136
+ }
137
+ //# sourceMappingURL=auto-cite.js.map
@@ -0,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C;YACjD,IAAI,QAAQ,KAAK,SAAS;gBAAE,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;YAC3D,IAAI,CAAC,CAAC,gBAAgB,KAAK,SAAS;gBAAE,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,gBAAgB,CAAC;YACjF,IAAI,CAAC,CAAC,kBAAkB,KAAK,SAAS;gBAAE,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC,kBAAkB,CAAC;YACvF,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC;YAC7C,IAAI,KAAK;gBAAE,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAEtC,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC;gBACxC,IAAI,CAAC,GAAG,CAAC,EAAE;oBAAE,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;gBAEvD,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;gBAC9D,OAAO,MAAM,CAAC,EAAE,CAAC;oBACf,aAAa;oBACb,cAAc,EAAE,UAAU,CAAC,MAAM;oBACjC,UAAU;oBACV,MAAM,EAAE,MAAM,IAAI,EAAE;oBACpB,KAAK;iBACN,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,MAAM,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YAClF,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,24 @@
1
+ export declare function createSciDrawTool(): {
2
+ label: string;
3
+ name: string;
4
+ description: string;
5
+ parameters: import("@sinclair/typebox").TObject<{
6
+ action: import("@sinclair/typebox").TString;
7
+ prompt: import("@sinclair/typebox").TString;
8
+ model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
9
+ imageSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
10
+ aspectRatio: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
11
+ images: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
12
+ stylePreset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
13
+ lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
14
+ }>;
15
+ execute: (_id: string, raw: unknown) => Promise<{
16
+ type: "tool_result";
17
+ content: {
18
+ type: "text";
19
+ text: string;
20
+ }[];
21
+ isError?: boolean;
22
+ }>;
23
+ };
24
+ //# sourceMappingURL=sci-draw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sci-draw.d.ts","sourceRoot":"","sources":["../../../src/tools/sci-draw.ts"],"names":[],"mappings":"AAkBA,wBAAgB,iBAAiB;;;;;;;;;;;;;;mBA8CR,MAAM,OAAO,OAAO;;;;;;;;EAmE5C"}
@@ -0,0 +1,113 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { getApiKey } from "./api-client.js";
3
+ import { readString } from "./params.js";
4
+ import { Result } from "./result.js";
5
+ const BASE_URL = "https://ai4scholar.net";
6
+ const TIMEOUT_MS = 300_000;
7
+ export function createSciDrawTool() {
8
+ return {
9
+ label: "Scientific Drawing",
10
+ name: "sci_draw",
11
+ description: "Generate or process scientific figures using AI. Actions: 'smart' (auto-optimize prompt, supports Chinese), '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.",
12
+ parameters: Type.Object({
13
+ action: Type.String({
14
+ description: "Operation type: 'smart', 'generate', 'edit', 'style', 'compose', 'iterate', 'critic', 'svg'",
15
+ enum: ["smart", "generate", "edit", "style", "compose", "iterate", "critic", "svg"],
16
+ }),
17
+ prompt: Type.String({
18
+ description: "Description or instruction for the image. Can be empty for 'critic' action. Supports Chinese in 'smart' mode.",
19
+ }),
20
+ model: Type.Optional(Type.String({
21
+ description: "Model: 'flash' (fast), 'flash31' (balanced, default), 'pro' (high quality)",
22
+ enum: ["flash", "flash31", "pro"],
23
+ })),
24
+ imageSize: Type.Optional(Type.String({
25
+ description: "Output resolution: '1K', '2K' (default), '4K'",
26
+ enum: ["1K", "2K", "4K"],
27
+ })),
28
+ aspectRatio: Type.Optional(Type.String({
29
+ description: "Aspect ratio: '1:1' (default), '16:9', '4:3', '3:4', '9:16'",
30
+ })),
31
+ images: Type.Optional(Type.Array(Type.String(), {
32
+ description: "Input images as base64 data URIs or URLs. Required for edit/style/compose/iterate/critic.",
33
+ })),
34
+ stylePreset: Type.Optional(Type.String({ description: "Style preset name (for 'style' action)" })),
35
+ lang: Type.Optional(Type.String({
36
+ description: "Language: 'en' (default), 'zh'",
37
+ enum: ["en", "zh"],
38
+ })),
39
+ }),
40
+ execute: async (_id, raw) => {
41
+ const p = raw;
42
+ const apiKey = getApiKey();
43
+ if (!apiKey)
44
+ return Result.err("no_api_key", "API key not configured");
45
+ const action = readString(p, "action", { required: true });
46
+ const prompt = readString(p, "prompt") ?? "";
47
+ const needsImages = ["edit", "style", "compose", "iterate", "critic"];
48
+ const images = p.images;
49
+ if (needsImages.includes(action) && (!images || images.length === 0)) {
50
+ return Result.err("missing_images", `Action '${action}' requires at least one image in the 'images' parameter`);
51
+ }
52
+ if (action === "compose" && images && images.length < 2) {
53
+ return Result.err("insufficient_images", "Action 'compose' requires at least 2 images");
54
+ }
55
+ const body = { action, prompt };
56
+ const model = readString(p, "model");
57
+ if (model)
58
+ body.model = model;
59
+ const imageSize = readString(p, "imageSize");
60
+ if (imageSize)
61
+ body.imageSize = imageSize;
62
+ const aspectRatio = readString(p, "aspectRatio");
63
+ if (aspectRatio)
64
+ body.aspectRatio = aspectRatio;
65
+ if (images)
66
+ body.images = images;
67
+ const stylePreset = readString(p, "stylePreset");
68
+ if (stylePreset)
69
+ body.stylePreset = stylePreset;
70
+ const lang = readString(p, "lang");
71
+ if (lang)
72
+ body.lang = lang;
73
+ try {
74
+ const res = await fetch(`${BASE_URL}/api/proxy/nano/generate`, {
75
+ method: "POST",
76
+ headers: {
77
+ Authorization: `Bearer ${apiKey}`,
78
+ "Content-Type": "application/json",
79
+ "User-Agent": "ai4scholar-openclaw/0.3",
80
+ },
81
+ body: JSON.stringify(body),
82
+ signal: AbortSignal.timeout(TIMEOUT_MS),
83
+ });
84
+ if (!res.ok) {
85
+ const errText = await res.text().catch(() => "");
86
+ return Result.err("api_error", `HTTP ${res.status}: ${errText}`);
87
+ }
88
+ const data = (await res.json());
89
+ if (!data.success) {
90
+ return Result.err("generation_failed", "Image generation failed");
91
+ }
92
+ const result = { action };
93
+ if (data.imageUrl)
94
+ result.imageUrl = data.imageUrl;
95
+ if (data.svgCode)
96
+ result.svgCode = data.svgCode;
97
+ if (data.svgUrl)
98
+ result.svgUrl = data.svgUrl;
99
+ if (data.optimizedPrompt)
100
+ result.optimizedPrompt = data.optimizedPrompt;
101
+ if (data.critique)
102
+ result.critique = data.critique;
103
+ if (data.creditCost !== undefined)
104
+ result.creditCost = data.creditCost;
105
+ return Result.ok(result);
106
+ }
107
+ catch (e) {
108
+ return Result.err("request_failed", e instanceof Error ? e.message : String(e));
109
+ }
110
+ },
111
+ };
112
+ }
113
+ //# sourceMappingURL=sci-draw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sci-draw.js","sourceRoot":"","sources":["../../../src/tools/sci-draw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO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AAC;KACF,CAAC;AACJ,CAAC"}
package/docs/tutorial.md CHANGED
@@ -1,35 +1,74 @@
1
- # AI4Scholar OpenClaw 插件:安装、配置与使用教程
1
+ # AI4Scholar OpenClaw 教程:安装、配置与使用
2
2
 
3
3
  > 让你的 OpenClaw 龙虾学会搜论文、读全文、评质量、加引用。
4
4
 
5
- ---
5
+ AI4Scholar 提供两种接入方式:
6
6
 
7
- ## 一、前提条件
7
+ | | MCP 方式(轻量) | 插件方式(完整) |
8
+ |---|---|---|
9
+ | 安装 | 无需安装,改配置即可 | 需要安装插件 |
10
+ | 学术搜索工具 | ✅ | ✅ 37 个工具 |
11
+ | PDF 下载/阅读 | ✅ | ✅ |
12
+ | 文献自动标注 | ❌ | ✅ `auto_cite` |
13
+ | 科研绘图 | ❌ | ✅ `sci_draw` |
14
+ | 论文质量评估(CCF) | ❌ | ✅ |
15
+ | 文献综述技能 | ❌ | ✅ |
16
+ | Scholar Mode 提示 | ❌ | ✅ |
17
+ | Slash 命令 | ❌ | ✅ |
8
18
 
9
- 在安装 AI4Scholar 插件之前,请确保以下环境已就绪:
19
+ **推荐**:如果你只想快速体验论文搜索,用 MCP 方式;如果需要完整的科研助手能力,装插件。
10
20
 
11
- - **OpenClaw** 已安装并可正常运行(版本 ≥ 2024.0.0)
12
- - **Node.js** ≥ 18
13
- - **ai4scholar.net 账号**(用于获取 API Key)
21
+ ---
14
22
 
15
- 如果你还需要生成 HTML 格式的文献综述报告(可选),额外需要:
23
+ ## 一、获取 API Key
16
24
 
17
- - **Python** ≥ 3.8
25
+ 1. 打开 [ai4scholar.net](https://ai4scholar.net?src=openclaw)
26
+ 2. 注册或登录你的账号
27
+ 3. 点击「创建 API Key」,复制生成的 Key
28
+
29
+ 请妥善保管你的 API Key,不要分享给他人。
18
30
 
19
31
  ---
20
32
 
21
- ## 二、获取 API Key
33
+ ## 二、方式一:MCP 接入(最简单)
22
34
 
23
- 1. 打开 [ai4scholar.net](https://ai4scholar.net)
24
- 2. 注册或登录你的账号
25
- 3. 进入 [API Keys 页面](https://ai4scholar.net/dashboard?view=api-keys)
26
- 4. 点击「创建 API Key」,复制生成的 Key
35
+ 只需在 `openclaw.json`(通常在 `~/.openclaw/openclaw.json`)中添加 MCP 服务器配置:
27
36
 
28
- 请妥善保管你的 API Key,不要分享给他人。
37
+ ```json
38
+ {
39
+ "mcpServers": {
40
+ "ai4scholar": {
41
+ "url": "https://mcp.ai4scholar.net/sse",
42
+ "headers": {
43
+ "Authorization": "Bearer 你的API Key"
44
+ }
45
+ }
46
+ }
47
+ }
48
+ ```
49
+
50
+ 重启 Gateway 即可使用:
51
+
52
+ ```bash
53
+ openclaw gateway stop && openclaw gateway start
54
+ ```
55
+
56
+ 配好后直接跟 Agent 对话就能搜论文了。如果你需要更多能力(文献综述、自动引用、质量评估等),继续往下看插件安装方式。
29
57
 
30
58
  ---
31
59
 
32
- ## 三、安装插件
60
+ ## 三、方式二:安装插件(完整体验)
61
+
62
+ ### 前提条件
63
+
64
+ - **OpenClaw** 已安装并可正常运行(版本 ≥ 2024.0.0)
65
+ - **Node.js** ≥ 18
66
+
67
+ 如果你还需要生成 HTML 格式的文献综述报告(可选),额外需要:
68
+
69
+ - **Python** ≥ 3.8
70
+
71
+ ### 安装
33
72
 
34
73
  在终端中执行:
35
74
 
@@ -37,12 +76,28 @@
37
76
  openclaw plugins install ai4scholar
38
77
  ```
39
78
 
79
+ 安装过程会自动下载依赖,通常需要 1-2 分钟。如果你的服务器在国内,建议先配置 npm 镜像源以加快速度:
80
+
81
+ ```bash
82
+ npm config set registry https://registry.npmmirror.com
83
+ ```
84
+
40
85
  安装完成后,重启 OpenClaw Gateway:
41
86
 
42
87
  ```bash
43
- openclaw gateway
88
+ openclaw gateway stop && openclaw gateway start
89
+ ```
90
+
91
+ > `openclaw gateway start` 会以后台服务方式运行,关闭终端也不会停止。如果只想前台调试,用 `openclaw gateway`(Ctrl+C 退出)。
92
+
93
+ ### 验证安装
94
+
95
+ ```bash
96
+ openclaw plugins list
44
97
  ```
45
98
 
99
+ 你应该能看到 `ai4scholar` 出现在已安装插件列表中。
100
+
46
101
  ### 从源码安装(可选)
47
102
 
48
103
  如果你想参与开发或查看源码:
@@ -55,44 +110,42 @@ pnpm build
55
110
  openclaw plugins install -l .
56
111
  ```
57
112
 
58
- ---
59
-
60
- ## 四、配置插件
113
+ ### 配置 API Key
61
114
 
62
- 安装完成后,需要在 `openclaw.json` 中配置 API Key。
115
+ 安装完成后,插件已自动启用,但还需要配置 API Key。启动 Gateway 时你会看到提示信息,告诉你如何配置。
63
116
 
64
- 打开你的 `openclaw.json` 文件,在 `plugins.entries` 下添加或修改 `ai4scholar` 配置:
117
+ 打开你的 `openclaw.json`(通常在 `~/.openclaw/openclaw.json`),找到 `ai4scholar` 部分,加上 `config`:
65
118
 
66
119
  ```json
67
- {
68
- "plugins": {
69
- "entries": {
70
- "ai4scholar": {
71
- "enabled": true,
72
- "config": {
73
- "apiKey": "你的API Key"
74
- }
75
- }
76
- }
120
+ "ai4scholar": {
121
+ "enabled": true,
122
+ "config": {
123
+ "apiKey": "你的API Key"
77
124
  }
78
125
  }
79
126
  ```
80
127
 
81
- 也可以通过环境变量设置:
128
+ > 安装器会自动创建 `"ai4scholar": { "enabled": true }`,你只需要加上 `"config": { "apiKey": "..." }` 这一行即可。
129
+
130
+ API Key 获取地址:[ai4scholar.net](https://ai4scholar.net?src=openclaw)
131
+
132
+ 配置完成后重启 Gateway 即可生效:
82
133
 
83
134
  ```bash
84
- export AI4SCHOLAR_API_KEY="你的API Key"
135
+ openclaw gateway stop && openclaw gateway start
85
136
  ```
86
137
 
87
- 配置完成后重启 Gateway 即可生效。
138
+ 启动日志中出现 `apiKey: configured` 说明配置成功。
139
+
140
+ > **提示**:arXiv、bioRxiv、medRxiv 的搜索和下载工具无需 API Key 即可使用。API Key 主要用于 Semantic Scholar、PubMed 和 Google Scholar。
88
141
 
89
142
  ---
90
143
 
91
- ## 五、插件能力一览
144
+ ## 四、插件能力一览
92
145
 
93
- 安装后,你的 OpenClaw Agent 将获得 **35 个学术工具**,覆盖 6 大数据库平台。
146
+ 安装后,你的 OpenClaw Agent 将获得 **37 个学术工具**,覆盖 6 大数据库平台。
94
147
 
95
- ### 5.1 论文搜索
148
+ ### 4.1 论文搜索
96
149
 
97
150
  | 工具 | 平台 | 说明 |
98
151
  |------|------|------|
@@ -106,7 +159,7 @@ export AI4SCHOLAR_API_KEY="你的API Key"
106
159
  | `search_semantic_bulk` | Semantic Scholar | 批量搜索,单次最多 1000 条 |
107
160
  | `search_semantic_paper_match` | Semantic Scholar | 按标题精确匹配 |
108
161
 
109
- ### 5.2 论文详情
162
+ ### 4.2 论文详情
110
163
 
111
164
  | 工具 | 说明 |
112
165
  |------|------|
@@ -115,7 +168,7 @@ export AI4SCHOLAR_API_KEY="你的API Key"
115
168
  | `get_semantic_paper_batch` | 批量获取论文详情(最多 500 篇) |
116
169
  | `get_pubmed_paper_batch` | 批量获取 PubMed 论文详情 |
117
170
 
118
- ### 5.3 引用与参考文献
171
+ ### 4.3 引用与参考文献
119
172
 
120
173
  | 工具 | 说明 |
121
174
  |------|------|
@@ -124,7 +177,7 @@ export AI4SCHOLAR_API_KEY="你的API Key"
124
177
  | `get_pubmed_citations` | PubMed 引用查询 |
125
178
  | `get_pubmed_related` | PubMed 相关论文推荐 |
126
179
 
127
- ### 5.4 作者信息
180
+ ### 4.4 作者信息
128
181
 
129
182
  | 工具 | 说明 |
130
183
  |------|------|
@@ -134,14 +187,14 @@ export AI4SCHOLAR_API_KEY="你的API Key"
134
187
  | `get_semantic_author_batch` | 批量获取作者详情(最多 1000 人) |
135
188
  | `get_semantic_paper_authors` | 获取某论文的所有作者详情 |
136
189
 
137
- ### 5.5 论文推荐
190
+ ### 4.5 论文推荐
138
191
 
139
192
  | 工具 | 说明 |
140
193
  |------|------|
141
194
  | `get_semantic_recommendations` | 基于多篇论文推荐相关论文 |
142
195
  | `get_semantic_recommendations_for_paper` | 基于单篇论文推荐 |
143
196
 
144
- ### 5.6 PDF 下载与全文阅读
197
+ ### 4.6 PDF 下载与全文阅读
145
198
 
146
199
  | 工具 | 说明 |
147
200
  |------|------|
@@ -156,15 +209,27 @@ export AI4SCHOLAR_API_KEY="你的API Key"
156
209
  | `download_by_doi` | 通过 DOI 下载论文 PDF(支持校园网机构访问) |
157
210
  | `read_by_doi` | 通过 DOI 下载并提取论文全文 |
158
211
 
159
- ### 5.7 论文质量评估
212
+ ### 4.7 论文质量评估
160
213
 
161
214
  | 工具 | 说明 |
162
215
  |------|------|
163
216
  | `paper_quality_rank` | 基于 CCF 分级、引用量、发表年份、作者 h-index 综合评分排序 |
164
217
 
218
+ ### 4.8 文献自动标注
219
+
220
+ | 工具 | 说明 |
221
+ |------|------|
222
+ | `auto_cite` | 一键为学术文本添加真实引用,支持 IEEE / APA / Vancouver / Nature 格式,返回标注文本 + 参考文献列表 + BibTeX |
223
+
224
+ ### 4.9 科研绘图
225
+
226
+ | 工具 | 说明 |
227
+ |------|------|
228
+ | `sci_draw` | AI 科研绘图:智能绘图(支持中文)、文生图、图片编辑、风格转换、多图组合、迭代优化、图片评审、SVG 矢量图 |
229
+
165
230
  ---
166
231
 
167
- ## 六、Slash 命令
232
+ ## 五、Slash 命令
168
233
 
169
234
  安装插件后,你可以在聊天中使用以下快捷命令:
170
235
 
@@ -176,11 +241,9 @@ export AI4SCHOLAR_API_KEY="你的API Key"
176
241
 
177
242
  ---
178
243
 
179
- ## 七、内置技能
244
+ ## 六、内置技能
180
245
 
181
- 插件包含两个 AI 技能,Agent 会根据你的需求自动调用。
182
-
183
- ### 7.1 文献综述(literature-survey)
246
+ ### 6.1 文献综述(literature-survey)
184
247
 
185
248
  **触发方式**:当你明确要求 Agent 做一份完整的文献综述或生成 HTML 报告时。
186
249
 
@@ -193,34 +256,9 @@ export AI4SCHOLAR_API_KEY="你的API Key"
193
256
 
194
257
  Agent 会自动执行多轮搜索、筛选、整理,生成结构化的综述报告。
195
258
 
196
- ### 7.2 自动引用标注(auto-cite)
197
-
198
- **触发方式**:当你粘贴一段学术文本,并要求 Agent 添加引用/参考文献时。
199
-
200
- **示例**:
201
-
202
- ```
203
- 请给下面这段文字加上引用:
204
-
205
- Large language models have shown remarkable capabilities in understanding
206
- and generating scientific text. Recent studies demonstrate that these models
207
- can assist in hypothesis generation, experimental design, and data analysis.
208
- The integration of tool-use capabilities further enhances their potential
209
- for automated scientific discovery.
210
- ```
211
-
212
- Agent 会自动:
213
- 1. 分析文本,识别需要引用的断言
214
- 2. 在 Semantic Scholar、PubMed 等平台搜索匹配论文
215
- 3. 用 `paper_quality_rank` 评估候选论文质量
216
- 4. 在原文中插入引用标记 [1]、[2, 3]
217
- 5. 在末尾生成 APA 格式参考文献列表
218
-
219
- 所有引用的论文都是从真实数据库搜索得到的,DOI 可验证。
220
-
221
259
  ---
222
260
 
223
- ## 八、使用示例
261
+ ## 七、使用示例
224
262
 
225
263
  以下是一些常见的使用场景,直接在聊天中发送即可。
226
264
 
@@ -269,9 +307,25 @@ Agent 会自动:
269
307
  ### 自动加引用
270
308
 
271
309
  ```
272
- 给下面这段 Introduction 加上引用:
310
+ 给下面这段 Introduction 加上引用,用 IEEE 格式:
311
+
312
+ (粘贴你的学术文本,100-10000 字符)
313
+ ```
314
+
315
+ Agent 会调用 `auto_cite` 工具,服务端自动完成引用匹配,返回标注好的文本和参考文献列表(约 20-60 秒)。
316
+
317
+ ### 科研绘图
318
+
319
+ ```
320
+ 帮我画一张蛋白质结构示意图,标注 alpha helix 和 beta sheet
321
+ ```
322
+
323
+ ```
324
+ 帮我画一张 CRISPR-Cas9 基因编辑机制图,用高质量模式
325
+ ```
273
326
 
274
- (粘贴你的学术文本)
327
+ ```
328
+ 把这张图转换成论文风格(发送图片后)
275
329
  ```
276
330
 
277
331
  ### 文献综述
@@ -283,7 +337,7 @@ Agent 会自动:
283
337
 
284
338
  ---
285
339
 
286
- ## 九、常见问题
340
+ ## 八、常见问题
287
341
 
288
342
  ### Q: 安装后提示 "plugin not found"
289
343
 
@@ -316,11 +370,15 @@ PDF 文本提取依赖论文的 PDF 格式。扫描版 PDF 或图片较多的论
316
370
  openclaw plugins install ai4scholar
317
371
  ```
318
372
 
319
- 重新执行安装命令会自动更新到最新版本。更新后需要重启 Gateway
373
+ 重新执行安装命令会自动更新到最新版本。更新后重启 Gateway
374
+
375
+ ```bash
376
+ openclaw gateway stop && openclaw gateway start
377
+ ```
320
378
 
321
379
  ---
322
380
 
323
- ## 十、反馈与贡献
381
+ ## 九、反馈与贡献
324
382
 
325
383
  - **GitHub**: [github.com/literaf/ai4scholar](https://github.com/literaf/ai4scholar)
326
384
  - **网站**: [ai4scholar.net](https://ai4scholar.net)
@@ -20,7 +20,7 @@
20
20
  "uiHints": {
21
21
  "apiKey": {
22
22
  "label": "AI4Scholar API Key",
23
- "description": "Get your key at https://ai4scholar.net/dashboard?view=api-keys",
23
+ "description": "Get your key at https://ai4scholar.net?src=openclaw",
24
24
  "inputType": "password"
25
25
  },
26
26
  "autoUpdate": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai4scholar",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
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",
@@ -71,6 +71,13 @@ metadata:
71
71
  |------|---------|
72
72
  | `paper_quality_rank` | Rank papers by quality score (CCF classification, citations, year, h-index) |
73
73
 
74
+ ### Auto-Citation & Scientific Drawing
75
+
76
+ | Tool | Purpose |
77
+ |------|---------|
78
+ | `auto_cite` | Automatically add real citations to academic text (server-side, supports IEEE/APA/Vancouver/Nature styles) |
79
+ | `sci_draw` | Generate scientific figures with AI (text-to-image, edit, style transfer, SVG, critique) |
80
+
74
81
  ### PDF Download & Full-text Reading
75
82
 
76
83
  | Tool | Purpose |
@@ -1,150 +0,0 @@
1
- ---
2
- name: auto-cite
3
- description: "Automatically add citation markers to academic text and generate a numbered reference list. Use when the user pastes a paragraph or section (e.g. Introduction, Related Work) and asks to add citations/references."
4
- metadata:
5
- {
6
- "openclaw":
7
- {
8
- "emoji": "📎",
9
- },
10
- }
11
- ---
12
-
13
- # Auto-Cite: Automatic Citation Annotation
14
-
15
- **Don't ask permission. Just do it.**
16
-
17
- ## What This Skill Does
18
-
19
- User pastes academic text → You identify where citations are needed → Search real papers → Insert citation markers [1], [2, 3] → Append a numbered APA reference list.
20
-
21
- Every cited paper MUST come from a real database (Semantic Scholar, PubMed, arXiv, bioRxiv, medRxiv). Never fabricate papers.
22
-
23
- ## Workflow
24
-
25
- ### Step 1: Analyze the Text
26
-
27
- Read the entire text. For each sentence, decide:
28
-
29
- **Needs citation:**
30
- - Factual claims ("X has been shown to...", "Studies have demonstrated...")
31
- - Methodological references ("The Transformer architecture...", "Using the BERT model...")
32
- - Statistical or quantitative claims ("affects 30% of...", "outperforms by 5%...")
33
- - Domain consensus ("It is widely accepted that...")
34
- - Comparisons or enumerations of existing methods
35
-
36
- **Does NOT need citation:**
37
- - The author's own contributions or opinions
38
- - Common knowledge ("Neural networks are computational models...")
39
- - Transitional sentences and connective text
40
- - Descriptions of the current paper's method
41
-
42
- Output a mental list of citation positions, each with:
43
- - The sentence or clause that needs a citation
44
- - What kind of support it needs (foundational work, method origin, evidence, survey)
45
- - 2-3 English search keywords
46
-
47
- ### Step 2: Search Papers
48
-
49
- For each citation position, search across appropriate platforms:
50
-
51
- | Text Domain | Primary Search | Secondary Search |
52
- |-------------|---------------|-----------------|
53
- | Biomedical / Clinical | `search_pubmed` | `search_semantic`, `search_biorxiv`, `search_medrxiv` |
54
- | Computer Science / AI / ML | `search_semantic` | `search_arxiv` |
55
- | General / Cross-discipline | `search_semantic` | `search_pubmed` |
56
- | Preprints / Cutting-edge | `search_arxiv`, `search_biorxiv` | `search_semantic` |
57
-
58
- For each position, search 10-20 candidates. Use English search terms even for Chinese input text.
59
-
60
- **Do NOT use** `search_google_scholar` for this workflow — use the five platforms above.
61
-
62
- ### Step 3: Rank by Quality
63
-
64
- Call `paper_quality_rank` with the candidate papers to get quality scores and CCF rankings.
65
-
66
- The tool evaluates:
67
- - **CCF rank** (A/B/C) for CS venues
68
- - **Citation count** (log-scaled)
69
- - **Publication year** (newer = better, within reason)
70
- - **Author h-index** (if available)
71
- - **arXiv penalty** (pure arXiv preprints score lower)
72
-
73
- ### Step 4: Select Best Matches
74
-
75
- For each citation position, pick the best 1-3 papers considering:
76
-
77
- 1. **Semantic relevance** (most important) — does the paper actually discuss what the sentence claims?
78
- 2. **Quality score** from Step 3 — prefer higher-ranked venues and more-cited papers
79
- 3. **Recency** — prefer newer papers unless citing foundational/seminal work
80
- 4. **Diversity** — avoid citing the same paper in too many positions; avoid citing only one research group
81
-
82
- **Deduplication rules:**
83
- - If the same paper matches multiple positions, use a single reference number across all positions
84
- - If a sentence needs multiple citations (e.g., listing several approaches), group them: [3, 5, 7]
85
- - Aim for 1-2 citations per position; 3 is the maximum unless enumerating methods
86
-
87
- ### Step 5: Generate Output
88
-
89
- Produce TWO sections:
90
-
91
- #### Part 1: Annotated Text
92
-
93
- The original text with [N] markers inserted at the correct positions.
94
-
95
- Rules:
96
- - Place markers at the END of the relevant clause or sentence, BEFORE the period
97
- - Use sequential numbering starting from [1]
98
- - Group multiple citations: [1, 2] or [3-5]
99
- - Preserve ALL original text — do not modify wording, only insert markers
100
-
101
- Example:
102
- ```
103
- Large language models have achieved remarkable performance across NLP tasks [1, 2]. However, these models often generate outputs misaligned with human values [3]. RLHF has emerged as a promising approach to address this challenge [4, 5].
104
- ```
105
-
106
- #### Part 2: Reference List
107
-
108
- Numbered APA-format references at the end. Each entry includes:
109
- - Authors (first author et al. if >3 authors)
110
- - Year in parentheses
111
- - Title
112
- - Journal/conference name
113
- - DOI or URL (if available)
114
-
115
- Format:
116
- ```
117
- [1] Brown, T. et al. (2020). Language Models are Few-Shot Learners. Advances in Neural Information Processing Systems, 33, 1877-1901.
118
- [2] Touvron, H. et al. (2023). LLaMA: Open and Efficient Foundation Language Models. arXiv:2302.13971.
119
- ```
120
-
121
- For papers with DOI, append the DOI link.
122
- For arXiv papers, use the arXiv ID format.
123
- For PubMed papers, include the PMID.
124
-
125
- ## Chinese Input
126
-
127
- When user provides Chinese text:
128
- - Search keywords must be in **English** (translate internally)
129
- - Annotated text output remains in **Chinese** (preserve original)
130
- - Reference list uses English (paper titles, author names stay in original language)
131
- - Respond in Chinese when communicating with the user
132
-
133
- ## Quality Checklist
134
-
135
- Before returning results, verify:
136
-
137
- - [ ] Every [N] marker corresponds to a real paper in the reference list
138
- - [ ] Every paper in the reference list has been verified via search tools (not hallucinated)
139
- - [ ] Citation positions are reasonable (factual claims have citations, opinions don't)
140
- - [ ] No duplicate entries in the reference list
141
- - [ ] Sequential numbering with no gaps
142
- - [ ] Reference list is in APA format
143
-
144
- ## Constraints
145
-
146
- - **Never fabricate papers** — every citation must come from tool search results
147
- - **Never modify the user's original text** beyond inserting [N] markers
148
- - Do not add citations to the author's own claims or contributions
149
- - If a passage is too vague to find good citations, skip it rather than force a bad match
150
- - Prefer published papers over preprints when both are available