@mlightcad/cad-llm-plugin 0.0.0-stage → 1.8.0-preview.5
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/LICENSE +21 -0
- package/README.md +70 -2
- package/dist/cad-llm-plugin-register.js +613 -0
- package/dist/cad-llm-plugin-register.umd.cjs +1 -0
- package/dist/cad-llm-plugin.js +21481 -0
- package/dist/cad-llm-plugin.umd.cjs +514 -0
- package/lib/AcApLlmPlugin.d.ts +39 -0
- package/lib/AcApLlmPlugin.d.ts.map +1 -0
- package/lib/AcApLlmPlugin.js +119 -0
- package/lib/AcApLlmPlugin.js.map +1 -0
- package/lib/AcApLlmTextRecognizer.d.ts +43 -0
- package/lib/AcApLlmTextRecognizer.d.ts.map +1 -0
- package/lib/AcApLlmTextRecognizer.js +303 -0
- package/lib/AcApLlmTextRecognizer.js.map +1 -0
- package/lib/command/AcApLlmSettingsCmd.d.ts +16 -0
- package/lib/command/AcApLlmSettingsCmd.d.ts.map +1 -0
- package/lib/command/AcApLlmSettingsCmd.js +114 -0
- package/lib/command/AcApLlmSettingsCmd.js.map +1 -0
- package/lib/constants.d.ts +7 -0
- package/lib/constants.d.ts.map +1 -0
- package/lib/constants.js +7 -0
- package/lib/constants.js.map +1 -0
- package/lib/i18n/ar.d.ts +77 -0
- package/lib/i18n/ar.d.ts.map +1 -0
- package/lib/i18n/ar.js +77 -0
- package/lib/i18n/ar.js.map +1 -0
- package/lib/i18n/command.d.ts +30 -0
- package/lib/i18n/command.d.ts.map +1 -0
- package/lib/i18n/command.js +30 -0
- package/lib/i18n/command.js.map +1 -0
- package/lib/i18n/cs.d.ts +77 -0
- package/lib/i18n/cs.d.ts.map +1 -0
- package/lib/i18n/cs.js +77 -0
- package/lib/i18n/cs.js.map +1 -0
- package/lib/i18n/en.d.ts +82 -0
- package/lib/i18n/en.d.ts.map +1 -0
- package/lib/i18n/en.js +82 -0
- package/lib/i18n/en.js.map +1 -0
- package/lib/i18n/index.d.ts +29 -0
- package/lib/i18n/index.d.ts.map +1 -0
- package/lib/i18n/index.js +142 -0
- package/lib/i18n/index.js.map +1 -0
- package/lib/i18n/ja.d.ts +77 -0
- package/lib/i18n/ja.d.ts.map +1 -0
- package/lib/i18n/ja.js +77 -0
- package/lib/i18n/ja.js.map +1 -0
- package/lib/i18n/ko.d.ts +77 -0
- package/lib/i18n/ko.d.ts.map +1 -0
- package/lib/i18n/ko.js +77 -0
- package/lib/i18n/ko.js.map +1 -0
- package/lib/i18n/tr.d.ts +77 -0
- package/lib/i18n/tr.d.ts.map +1 -0
- package/lib/i18n/tr.js +77 -0
- package/lib/i18n/tr.js.map +1 -0
- package/lib/i18n/zh.d.ts +77 -0
- package/lib/i18n/zh.d.ts.map +1 -0
- package/lib/i18n/zh.js +77 -0
- package/lib/i18n/zh.js.map +1 -0
- package/lib/index.d.ts +25 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +25 -0
- package/lib/index.js.map +1 -0
- package/lib/model/AcApLlmModelFactory.d.ts +14 -0
- package/lib/model/AcApLlmModelFactory.d.ts.map +1 -0
- package/lib/model/AcApLlmModelFactory.js +46 -0
- package/lib/model/AcApLlmModelFactory.js.map +1 -0
- package/lib/model/AcApLlmModelListing.d.ts +67 -0
- package/lib/model/AcApLlmModelListing.d.ts.map +1 -0
- package/lib/model/AcApLlmModelListing.js +275 -0
- package/lib/model/AcApLlmModelListing.js.map +1 -0
- package/lib/model/anthropicBrowserAccess.d.ts +8 -0
- package/lib/model/anthropicBrowserAccess.d.ts.map +1 -0
- package/lib/model/anthropicBrowserAccess.js +8 -0
- package/lib/model/anthropicBrowserAccess.js.map +1 -0
- package/lib/model/normalizeLlmBaseUrl.d.ts +17 -0
- package/lib/model/normalizeLlmBaseUrl.d.ts.map +1 -0
- package/lib/model/normalizeLlmBaseUrl.js +31 -0
- package/lib/model/normalizeLlmBaseUrl.js.map +1 -0
- package/lib/model/openAiCompatibleFetch.d.ts +11 -0
- package/lib/model/openAiCompatibleFetch.d.ts.map +1 -0
- package/lib/model/openAiCompatibleFetch.js +122 -0
- package/lib/model/openAiCompatibleFetch.js.map +1 -0
- package/lib/model/skipDataUrlDownload.d.ts +12 -0
- package/lib/model/skipDataUrlDownload.d.ts.map +1 -0
- package/lib/model/skipDataUrlDownload.js +58 -0
- package/lib/model/skipDataUrlDownload.js.map +1 -0
- package/lib/register.d.ts +20 -0
- package/lib/register.d.ts.map +1 -0
- package/lib/register.js +139 -0
- package/lib/register.js.map +1 -0
- package/lib/storage/AcApLlmConfigStore.d.ts +218 -0
- package/lib/storage/AcApLlmConfigStore.d.ts.map +1 -0
- package/lib/storage/AcApLlmConfigStore.js +637 -0
- package/lib/storage/AcApLlmConfigStore.js.map +1 -0
- package/lib/storage/AcApLlmModelCatalog.d.ts +68 -0
- package/lib/storage/AcApLlmModelCatalog.d.ts.map +1 -0
- package/lib/storage/AcApLlmModelCatalog.js +141 -0
- package/lib/storage/AcApLlmModelCatalog.js.map +1 -0
- package/lib/storage/apiKeyCrypto.d.ts +28 -0
- package/lib/storage/apiKeyCrypto.d.ts.map +1 -0
- package/lib/storage/apiKeyCrypto.js +214 -0
- package/lib/storage/apiKeyCrypto.js.map +1 -0
- package/lib/storage/settingsEquality.d.ts +10 -0
- package/lib/storage/settingsEquality.d.ts.map +1 -0
- package/lib/storage/settingsEquality.js +36 -0
- package/lib/storage/settingsEquality.js.map +1 -0
- package/lib/ui/AcApLlmModelChoices.d.ts +31 -0
- package/lib/ui/AcApLlmModelChoices.d.ts.map +1 -0
- package/lib/ui/AcApLlmModelChoices.js +68 -0
- package/lib/ui/AcApLlmModelChoices.js.map +1 -0
- package/lib/ui/AcApLlmProviderLabels.d.ts +19 -0
- package/lib/ui/AcApLlmProviderLabels.d.ts.map +1 -0
- package/lib/ui/AcApLlmProviderLabels.js +34 -0
- package/lib/ui/AcApLlmProviderLabels.js.map +1 -0
- package/lib/ui/AcUiLlmSettingsDialog.d.ts +125 -0
- package/lib/ui/AcUiLlmSettingsDialog.d.ts.map +1 -0
- package/lib/ui/AcUiLlmSettingsDialog.js +1218 -0
- package/lib/ui/AcUiLlmSettingsDialog.js.map +1 -0
- package/lib/ui/llmSettingsStyles.d.ts +6 -0
- package/lib/ui/llmSettingsStyles.d.ts.map +1 -0
- package/lib/ui/llmSettingsStyles.js +6 -0
- package/lib/ui/llmSettingsStyles.js.map +1 -0
- package/package.json +54 -3
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AcApContext, AcApPlugin, AcEdCommandStack } from '@mlightcad/cad-simple-viewer';
|
|
2
|
+
/**
|
|
3
|
+
* Shared AI model settings plugin.
|
|
4
|
+
*
|
|
5
|
+
* Registers the `llmsettings` command, which opens
|
|
6
|
+
* {@link AcUiLlmSettingsDialog}. Register it lazily with
|
|
7
|
+
* {@link registerLazyLlmPlugin}.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AcApLlmPlugin implements AcApPlugin {
|
|
10
|
+
/** @inheritdoc */
|
|
11
|
+
name: string;
|
|
12
|
+
/** @inheritdoc */
|
|
13
|
+
version: string;
|
|
14
|
+
/** @inheritdoc */
|
|
15
|
+
description: string;
|
|
16
|
+
/** Commands registered in {@link onLoad} for cleanup in {@link onUnload}. */
|
|
17
|
+
private registeredCommands;
|
|
18
|
+
/**
|
|
19
|
+
* Registers the `llmsettings` system command.
|
|
20
|
+
*
|
|
21
|
+
* @param _context - Application context (unused).
|
|
22
|
+
* @param commandManager - Command stack that receives the command.
|
|
23
|
+
*/
|
|
24
|
+
onLoad(_context: AcApContext, commandManager: AcEdCommandStack): void;
|
|
25
|
+
/**
|
|
26
|
+
* Removes commands registered in {@link onLoad}.
|
|
27
|
+
*
|
|
28
|
+
* @param _context - Application context (unused).
|
|
29
|
+
* @param commandManager - Command stack that owns the commands.
|
|
30
|
+
*/
|
|
31
|
+
onUnload(_context: AcApContext, commandManager: AcEdCommandStack): void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates the AI model settings plugin.
|
|
35
|
+
*
|
|
36
|
+
* @returns A new {@link AcApLlmPlugin}.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createLlmPlugin(): Promise<AcApLlmPlugin>;
|
|
39
|
+
//# sourceMappingURL=AcApLlmPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApLlmPlugin.d.ts","sourceRoot":"","sources":["../src/AcApLlmPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EACjB,MAAM,8BAA8B,CAAA;AAMrC;;;;;;GAMG;AACH,qBAAa,aAAc,YAAW,UAAU;IAC9C,kBAAkB;IAClB,IAAI,SAAkB;IACtB,kBAAkB;IAClB,OAAO,SAAsB;IAC7B,kBAAkB;IAClB,WAAW,SACwD;IAEnE,6EAA6E;IAC7E,OAAO,CAAC,kBAAkB,CAA6C;IAEvE;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,GAAG,IAAI;IAWrE;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,GAAG,IAAI;CAMxE;AAED;;;;GAIG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,aAAa,CAAC,CAE9D"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var __values = (this && this.__values) || function(o) {
|
|
38
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
39
|
+
if (m) return m.call(o);
|
|
40
|
+
if (o && typeof o.length === "number") return {
|
|
41
|
+
next: function () {
|
|
42
|
+
if (o && i >= o.length) o = void 0;
|
|
43
|
+
return { value: o && o[i++], done: !o };
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
47
|
+
};
|
|
48
|
+
import { AcEdCommandStack } from '@mlightcad/cad-simple-viewer';
|
|
49
|
+
import packageJson from '../package.json';
|
|
50
|
+
import { AcApLlmSettingsCmd } from './command/AcApLlmSettingsCmd.js';
|
|
51
|
+
import { LLM_PLUGIN_NAME } from './constants.js';
|
|
52
|
+
/**
|
|
53
|
+
* Shared AI model settings plugin.
|
|
54
|
+
*
|
|
55
|
+
* Registers the `llmsettings` command, which opens
|
|
56
|
+
* {@link AcUiLlmSettingsDialog}. Register it lazily with
|
|
57
|
+
* {@link registerLazyLlmPlugin}.
|
|
58
|
+
*/
|
|
59
|
+
var AcApLlmPlugin = /** @class */ (function () {
|
|
60
|
+
function AcApLlmPlugin() {
|
|
61
|
+
/** @inheritdoc */
|
|
62
|
+
this.name = LLM_PLUGIN_NAME;
|
|
63
|
+
/** @inheritdoc */
|
|
64
|
+
this.version = packageJson.version;
|
|
65
|
+
/** @inheritdoc */
|
|
66
|
+
this.description = 'Shared AI model settings (llmsettings) and LLM text recognition';
|
|
67
|
+
/** Commands registered in {@link onLoad} for cleanup in {@link onUnload}. */
|
|
68
|
+
this.registeredCommands = [];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Registers the `llmsettings` system command.
|
|
72
|
+
*
|
|
73
|
+
* @param _context - Application context (unused).
|
|
74
|
+
* @param commandManager - Command stack that receives the command.
|
|
75
|
+
*/
|
|
76
|
+
AcApLlmPlugin.prototype.onLoad = function (_context, commandManager) {
|
|
77
|
+
var group = AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME;
|
|
78
|
+
commandManager.addCommand(group, 'llmsettings', 'llmsettings', new AcApLlmSettingsCmd());
|
|
79
|
+
this.registeredCommands.push({ group: group, name: 'llmsettings' });
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Removes commands registered in {@link onLoad}.
|
|
83
|
+
*
|
|
84
|
+
* @param _context - Application context (unused).
|
|
85
|
+
* @param commandManager - Command stack that owns the commands.
|
|
86
|
+
*/
|
|
87
|
+
AcApLlmPlugin.prototype.onUnload = function (_context, commandManager) {
|
|
88
|
+
var e_1, _a;
|
|
89
|
+
try {
|
|
90
|
+
for (var _b = __values(this.registeredCommands), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
91
|
+
var cmd = _c.value;
|
|
92
|
+
commandManager.removeCmd(cmd.group, cmd.name);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
96
|
+
finally {
|
|
97
|
+
try {
|
|
98
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
99
|
+
}
|
|
100
|
+
finally { if (e_1) throw e_1.error; }
|
|
101
|
+
}
|
|
102
|
+
this.registeredCommands = [];
|
|
103
|
+
};
|
|
104
|
+
return AcApLlmPlugin;
|
|
105
|
+
}());
|
|
106
|
+
export { AcApLlmPlugin };
|
|
107
|
+
/**
|
|
108
|
+
* Creates the AI model settings plugin.
|
|
109
|
+
*
|
|
110
|
+
* @returns A new {@link AcApLlmPlugin}.
|
|
111
|
+
*/
|
|
112
|
+
export function createLlmPlugin() {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
+
return __generator(this, function (_a) {
|
|
115
|
+
return [2 /*return*/, new AcApLlmPlugin()];
|
|
116
|
+
});
|
|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G,CAAC,IAAI,CAAC,CAAA;YAC/C,CAAC;;;;;;;;;QACD,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAA;IAC9B,CAAC;IACH,oBAAC;AAAD,CAAC,AAzCD,IAyCC;;AAED;;;;GAIG;AACH,MAAM,UAAgB,eAAe;;;YACnC,sBAAO,IAAI,aAAa,EAAE,EAAA;;;CAC3B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AcApTextBatchRecognitionRequest, AcApTextRecognitionRequest } from '@mlightcad/cad-simple-viewer';
|
|
2
|
+
/**
|
|
3
|
+
* Longest wait for one recognition request, in milliseconds. A provider that
|
|
4
|
+
* never answers would otherwise keep the busy indicator up forever.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ACAP_LLM_RECOGNITION_TIMEOUT_MS = 120000;
|
|
7
|
+
/**
|
|
8
|
+
* Reads several stroke images, {@link BATCH_SIZE} per LLM request, instead of
|
|
9
|
+
* one request per image: the drawing's lines are recognized in a few
|
|
10
|
+
* prompts, which is faster and repeats the instructions less often.
|
|
11
|
+
*
|
|
12
|
+
* Uses the same model as {@link acapLlmRecognizeText}. Returns no text when
|
|
13
|
+
* no vision-capable model is configured. When every request fails, the first
|
|
14
|
+
* error is thrown so the caller can tell the user; images of a failed request
|
|
15
|
+
* among successful ones are returned unread.
|
|
16
|
+
*
|
|
17
|
+
* @param request - Images, locale and abort signal.
|
|
18
|
+
* @returns One entry per image, in order; `undefined` when unread.
|
|
19
|
+
*/
|
|
20
|
+
export declare function acapLlmRecognizeTextBatch(request: AcApTextBatchRecognitionRequest): Promise<Array<string | undefined>>;
|
|
21
|
+
/**
|
|
22
|
+
* Parses a batch answer: the first JSON array in `text` (code fences and
|
|
23
|
+
* surrounding words are ignored), cleaned and aligned to `count` entries.
|
|
24
|
+
*
|
|
25
|
+
* @throws When the answer holds no JSON array of strings.
|
|
26
|
+
*/
|
|
27
|
+
export declare function acapLlmParseBatchText(text: string, count: number): Array<string | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Reads the text in a rendered stroke image with the configured LLM.
|
|
30
|
+
*
|
|
31
|
+
* Uses the active model when it accepts images, otherwise the first
|
|
32
|
+
* vision-capable model of a configured provider (see
|
|
33
|
+
* {@link acapLlmResolveVisionSettings}). Returns `undefined` when there is
|
|
34
|
+
* none, so callers fall back to manual input. Registered as the `cad-llm`
|
|
35
|
+
* recognizer in `AcApTextRecognitionService` by `registerLazyLlmPlugin`.
|
|
36
|
+
*
|
|
37
|
+
* @param request - Image, optional context hint, locale and abort signal.
|
|
38
|
+
* @returns Recognized text, or `undefined`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function acapLlmRecognizeText(request: AcApTextRecognitionRequest): Promise<string | undefined>;
|
|
41
|
+
/** Strips wrapping quotes / code fences some models add despite the prompt. */
|
|
42
|
+
export declare function acapLlmCleanRecognizedText(text: string): string | undefined;
|
|
43
|
+
//# sourceMappingURL=AcApLlmTextRecognizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApLlmTextRecognizer.d.ts","sourceRoot":"","sources":["../src/AcApLlmTextRecognizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAC3B,MAAM,8BAA8B,CAAA;AA6BrC;;;GAGG;AACH,eAAO,MAAM,+BAA+B,SAAU,CAAA;AA8CtD;;;;;;;;;;;;GAYG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CA6DpC;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAe3B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAiC7B;AAED,+EAA+E;AAC/E,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO3E"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
38
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
39
|
+
if (!m) return o;
|
|
40
|
+
var i = m.call(o), r, ar = [], e;
|
|
41
|
+
try {
|
|
42
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
43
|
+
}
|
|
44
|
+
catch (error) { e = { error: error }; }
|
|
45
|
+
finally {
|
|
46
|
+
try {
|
|
47
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
48
|
+
}
|
|
49
|
+
finally { if (e) throw e.error; }
|
|
50
|
+
}
|
|
51
|
+
return ar;
|
|
52
|
+
};
|
|
53
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
54
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
55
|
+
if (ar || !(i in from)) {
|
|
56
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
57
|
+
ar[i] = from[i];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
61
|
+
};
|
|
62
|
+
import { generateText } from 'ai';
|
|
63
|
+
import { llmT } from './i18n/index.js';
|
|
64
|
+
import { acapLlmCreateModel } from './model/AcApLlmModelFactory.js';
|
|
65
|
+
import { acapLlmSkipDataUrlDownload } from './model/skipDataUrlDownload.js';
|
|
66
|
+
import { acapLlmLoadConfig, acapLlmResolveVisionSettings } from './storage/AcApLlmConfigStore.js';
|
|
67
|
+
var TEXT_RECOGNITION_SYSTEM_PROMPT = "You read text from images of CAD drawings.\n\nThe image shows one line of text drawn as strokes (for example SHX single-line\nfonts), dark on white, upright. Reply with exactly the text shown, preserving\ncase, digits, punctuation, CAD symbols such as \u00D8 \u00B1 \u00B0 and spaces between words.\nDo not explain, translate, quote or add anything else. If nothing is legible,\nreply with an empty message.";
|
|
68
|
+
var BATCH_TEXT_RECOGNITION_SYSTEM_PROMPT = "You read text from images of CAD drawings.\n\nYou get several numbered images. Each shows one line of text drawn as strokes\n(for example SHX single-line fonts), dark on white, upright. Read every image\nexactly: preserve case, digits, punctuation, CAD symbols such as \u00D8 \u00B1 \u00B0 and\nspaces between words. Do not explain, translate or correct the text.\n\nReply with only a JSON array of strings, one per image in the given order,\nand exactly as many entries as images. Use \"\" for an image that is not legible.";
|
|
69
|
+
/**
|
|
70
|
+
* Longest wait for one recognition request, in milliseconds. A provider that
|
|
71
|
+
* never answers would otherwise keep the busy indicator up forever.
|
|
72
|
+
*/
|
|
73
|
+
export var ACAP_LLM_RECOGNITION_TIMEOUT_MS = 120000;
|
|
74
|
+
/**
|
|
75
|
+
* Runs one model request, limited to
|
|
76
|
+
* {@link ACAP_LLM_RECOGNITION_TIMEOUT_MS}.
|
|
77
|
+
*
|
|
78
|
+
* The request gets its own signal, aborted by the caller's `signal` or by
|
|
79
|
+
* the timeout. The timeout also rejects the race directly, so it works even
|
|
80
|
+
* when a provider ignores the abort.
|
|
81
|
+
*
|
|
82
|
+
* @throws A localized timeout error when the limit is reached.
|
|
83
|
+
*/
|
|
84
|
+
function runWithTimeout(signal, run) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
+
var controller, forward, timer, timeout;
|
|
87
|
+
return __generator(this, function (_a) {
|
|
88
|
+
switch (_a.label) {
|
|
89
|
+
case 0:
|
|
90
|
+
controller = new AbortController();
|
|
91
|
+
forward = function () { return controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason); };
|
|
92
|
+
if (signal === null || signal === void 0 ? void 0 : signal.aborted)
|
|
93
|
+
forward();
|
|
94
|
+
else
|
|
95
|
+
signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', forward, { once: true });
|
|
96
|
+
timeout = new Promise(function (_, reject) {
|
|
97
|
+
timer = setTimeout(function () {
|
|
98
|
+
var error = new Error(llmT('recognitionTimeout', {
|
|
99
|
+
seconds: Math.round(ACAP_LLM_RECOGNITION_TIMEOUT_MS / 1000)
|
|
100
|
+
}));
|
|
101
|
+
controller.abort(error);
|
|
102
|
+
reject(error);
|
|
103
|
+
}, ACAP_LLM_RECOGNITION_TIMEOUT_MS);
|
|
104
|
+
});
|
|
105
|
+
_a.label = 1;
|
|
106
|
+
case 1:
|
|
107
|
+
_a.trys.push([1, , 3, 4]);
|
|
108
|
+
return [4 /*yield*/, Promise.race([run(controller.signal), timeout])];
|
|
109
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
110
|
+
case 3:
|
|
111
|
+
clearTimeout(timer);
|
|
112
|
+
signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', forward);
|
|
113
|
+
return [7 /*endfinally*/];
|
|
114
|
+
case 4: return [2 /*return*/];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/** Most images sent in one recognition request. */
|
|
120
|
+
var BATCH_SIZE = 20;
|
|
121
|
+
/** Most batch requests in flight at once. */
|
|
122
|
+
var BATCH_CONCURRENCY = 3;
|
|
123
|
+
/**
|
|
124
|
+
* Reads several stroke images, {@link BATCH_SIZE} per LLM request, instead of
|
|
125
|
+
* one request per image: the drawing's lines are recognized in a few
|
|
126
|
+
* prompts, which is faster and repeats the instructions less often.
|
|
127
|
+
*
|
|
128
|
+
* Uses the same model as {@link acapLlmRecognizeText}. Returns no text when
|
|
129
|
+
* no vision-capable model is configured. When every request fails, the first
|
|
130
|
+
* error is thrown so the caller can tell the user; images of a failed request
|
|
131
|
+
* among successful ones are returned unread.
|
|
132
|
+
*
|
|
133
|
+
* @param request - Images, locale and abort signal.
|
|
134
|
+
* @returns One entry per image, in order; `undefined` when unread.
|
|
135
|
+
*/
|
|
136
|
+
export function acapLlmRecognizeTextBatch(request) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
138
|
+
var config, settings, none, chunks, i, readChunk, settled, i, _a, _b, _c, _d, failed;
|
|
139
|
+
var _this = this;
|
|
140
|
+
return __generator(this, function (_e) {
|
|
141
|
+
switch (_e.label) {
|
|
142
|
+
case 0: return [4 /*yield*/, acapLlmLoadConfig()];
|
|
143
|
+
case 1:
|
|
144
|
+
config = _e.sent();
|
|
145
|
+
settings = acapLlmResolveVisionSettings(config);
|
|
146
|
+
none = request.images.map(function () { return undefined; });
|
|
147
|
+
if (!settings || request.images.length === 0)
|
|
148
|
+
return [2 /*return*/, none];
|
|
149
|
+
chunks = [];
|
|
150
|
+
for (i = 0; i < request.images.length; i += BATCH_SIZE) {
|
|
151
|
+
chunks.push(request.images.slice(i, i + BATCH_SIZE));
|
|
152
|
+
}
|
|
153
|
+
readChunk = function (images) { return __awaiter(_this, void 0, void 0, function () {
|
|
154
|
+
var text;
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
switch (_a.label) {
|
|
157
|
+
case 0: return [4 /*yield*/, runWithTimeout(request.signal, function (abortSignal) {
|
|
158
|
+
return generateText({
|
|
159
|
+
model: acapLlmCreateModel(settings),
|
|
160
|
+
system: BATCH_TEXT_RECOGNITION_SYSTEM_PROMPT,
|
|
161
|
+
abortSignal: abortSignal,
|
|
162
|
+
experimental_download: acapLlmSkipDataUrlDownload,
|
|
163
|
+
messages: [
|
|
164
|
+
{
|
|
165
|
+
role: 'user',
|
|
166
|
+
content: __spreadArray([
|
|
167
|
+
{
|
|
168
|
+
type: 'text',
|
|
169
|
+
text: [
|
|
170
|
+
"Read the text in these ".concat(images.length, " images."),
|
|
171
|
+
request.locale ? "UI language: ".concat(request.locale, ".") : ''
|
|
172
|
+
]
|
|
173
|
+
.filter(Boolean)
|
|
174
|
+
.join(' ')
|
|
175
|
+
}
|
|
176
|
+
], __read(images.flatMap(function (image, i) { return [
|
|
177
|
+
{ type: 'text', text: "Image ".concat(i + 1, ":") },
|
|
178
|
+
{ type: 'image', image: image }
|
|
179
|
+
]; })), false)
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
});
|
|
183
|
+
})];
|
|
184
|
+
case 1:
|
|
185
|
+
text = (_a.sent()).text;
|
|
186
|
+
return [2 /*return*/, acapLlmParseBatchText(text, images.length)];
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}); };
|
|
190
|
+
settled = [];
|
|
191
|
+
i = 0;
|
|
192
|
+
_e.label = 2;
|
|
193
|
+
case 2:
|
|
194
|
+
if (!(i < chunks.length)) return [3 /*break*/, 5];
|
|
195
|
+
_b = (_a = settled.push).apply;
|
|
196
|
+
_c = [settled];
|
|
197
|
+
_d = [[]];
|
|
198
|
+
return [4 /*yield*/, Promise.allSettled(chunks.slice(i, i + BATCH_CONCURRENCY).map(readChunk))];
|
|
199
|
+
case 3:
|
|
200
|
+
_b.apply(_a, _c.concat([__spreadArray.apply(void 0, _d.concat([__read.apply(void 0, [(_e.sent())]), false]))]));
|
|
201
|
+
_e.label = 4;
|
|
202
|
+
case 4:
|
|
203
|
+
i += BATCH_CONCURRENCY;
|
|
204
|
+
return [3 /*break*/, 2];
|
|
205
|
+
case 5:
|
|
206
|
+
failed = settled.find(function (result) { return result.status === 'rejected'; });
|
|
207
|
+
if (failed && settled.every(function (result) { return result.status === 'rejected'; })) {
|
|
208
|
+
throw failed.reason;
|
|
209
|
+
}
|
|
210
|
+
return [2 /*return*/, settled.flatMap(function (result, i) {
|
|
211
|
+
return result.status === 'fulfilled'
|
|
212
|
+
? result.value
|
|
213
|
+
: chunks[i].map(function () { return undefined; });
|
|
214
|
+
})];
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Parses a batch answer: the first JSON array in `text` (code fences and
|
|
221
|
+
* surrounding words are ignored), cleaned and aligned to `count` entries.
|
|
222
|
+
*
|
|
223
|
+
* @throws When the answer holds no JSON array of strings.
|
|
224
|
+
*/
|
|
225
|
+
export function acapLlmParseBatchText(text, count) {
|
|
226
|
+
var start = text.indexOf('[');
|
|
227
|
+
var end = text.lastIndexOf(']');
|
|
228
|
+
var parsed = start >= 0 && end > start ? JSON.parse(text.slice(start, end + 1)) : null;
|
|
229
|
+
if (!Array.isArray(parsed)) {
|
|
230
|
+
throw new Error("Unexpected text recognition answer: ".concat(text.trim().slice(0, 80)));
|
|
231
|
+
}
|
|
232
|
+
return Array.from({ length: count }, function (_, i) {
|
|
233
|
+
return typeof parsed[i] === 'string'
|
|
234
|
+
? acapLlmCleanRecognizedText(parsed[i])
|
|
235
|
+
: undefined;
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Reads the text in a rendered stroke image with the configured LLM.
|
|
240
|
+
*
|
|
241
|
+
* Uses the active model when it accepts images, otherwise the first
|
|
242
|
+
* vision-capable model of a configured provider (see
|
|
243
|
+
* {@link acapLlmResolveVisionSettings}). Returns `undefined` when there is
|
|
244
|
+
* none, so callers fall back to manual input. Registered as the `cad-llm`
|
|
245
|
+
* recognizer in `AcApTextRecognitionService` by `registerLazyLlmPlugin`.
|
|
246
|
+
*
|
|
247
|
+
* @param request - Image, optional context hint, locale and abort signal.
|
|
248
|
+
* @returns Recognized text, or `undefined`.
|
|
249
|
+
*/
|
|
250
|
+
export function acapLlmRecognizeText(request) {
|
|
251
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
252
|
+
var config, settings, hints, text;
|
|
253
|
+
return __generator(this, function (_a) {
|
|
254
|
+
switch (_a.label) {
|
|
255
|
+
case 0: return [4 /*yield*/, acapLlmLoadConfig()];
|
|
256
|
+
case 1:
|
|
257
|
+
config = _a.sent();
|
|
258
|
+
settings = acapLlmResolveVisionSettings(config);
|
|
259
|
+
if (!settings)
|
|
260
|
+
return [2 /*return*/, undefined];
|
|
261
|
+
hints = [
|
|
262
|
+
request.locale ? "UI language: ".concat(request.locale, ".") : '',
|
|
263
|
+
request.hint
|
|
264
|
+
? "The previous line of this drawing read: \"".concat(request.hint, "\".")
|
|
265
|
+
: ''
|
|
266
|
+
].filter(Boolean);
|
|
267
|
+
return [4 /*yield*/, runWithTimeout(request.signal, function (abortSignal) {
|
|
268
|
+
return generateText({
|
|
269
|
+
model: acapLlmCreateModel(settings),
|
|
270
|
+
system: TEXT_RECOGNITION_SYSTEM_PROMPT,
|
|
271
|
+
abortSignal: abortSignal,
|
|
272
|
+
experimental_download: acapLlmSkipDataUrlDownload,
|
|
273
|
+
messages: [
|
|
274
|
+
{
|
|
275
|
+
role: 'user',
|
|
276
|
+
content: [
|
|
277
|
+
{
|
|
278
|
+
type: 'text',
|
|
279
|
+
text: __spreadArray(['Read the text in this image.'], __read(hints), false).join(' ')
|
|
280
|
+
},
|
|
281
|
+
{ type: 'image', image: request.image }
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
});
|
|
286
|
+
})];
|
|
287
|
+
case 2:
|
|
288
|
+
text = (_a.sent()).text;
|
|
289
|
+
return [2 /*return*/, acapLlmCleanRecognizedText(text)];
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
/** Strips wrapping quotes / code fences some models add despite the prompt. */
|
|
295
|
+
export function acapLlmCleanRecognizedText(text) {
|
|
296
|
+
var cleaned = text.trim();
|
|
297
|
+
cleaned = cleaned.replace(/^```[a-z]*\s*|\s*```$/gi, '').trim();
|
|
298
|
+
if (/^(["'“”‘’`]).*\1$/.test(cleaned) || /^“.*”$/.test(cleaned)) {
|
|
299
|
+
cleaned = cleaned.slice(1, -1).trim();
|
|
300
|
+
}
|
|
301
|
+
return cleaned || undefined;
|
|
302
|
+
}
|
|
303
|
+
//# sourceMappingURL=AcApLlmTextRecognizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApLlmTextRecognizer.js","sourceRoot":"","sources":["../src/AcApLlmTextRecognizer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAA;AAC3E,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC7B,MAAM,iCAAiC,CAAA;AAExC,IAAM,8BAA8B,GAAG,yZAMV,CAAA;AAE7B,IAAM,oCAAoC,GAAG,8gBAQmC,CAAA;AAEhF;;;GAGG;AACH,MAAM,CAAC,IAAM,+BAA+B,GAAG,MAAO,CAAA;AAEtD;;;;;;;;;GASG;AACH,SAAe,cAAc,CAC3B,MAA+B,EAC/B,GAAwC;;;;;;oBAElC,UAAU,GAAG,IAAI,eAAe,EAAE,CAAA;oBAClC,OAAO,GAAG,cAAM,OAAA,UAAU,CAAC,KAAK,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAC,EAAhC,CAAgC,CAAA;oBACtD,IAAI,MAAM,aAAN,MA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cEdCommand } from '@mlightcad/cad-simple-viewer';
|
|
2
|
+
/**
|
|
3
|
+
* Opens the shared AI model settings dialog. The command name is
|
|
4
|
+
* `llmsettings`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AcApLlmSettingsCmd extends AcEdCommand {
|
|
7
|
+
/** The settings live in browser storage, not in the drawing. */
|
|
8
|
+
recordsUndoStack: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Shows {@link AcUiLlmSettingsDialog} over the current view.
|
|
11
|
+
*
|
|
12
|
+
* @param context - Application context providing the view host.
|
|
13
|
+
*/
|
|
14
|
+
execute(context: AcApContext): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=AcApLlmSettingsCmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApLlmSettingsCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApLlmSettingsCmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAI5E;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;IACjD,gEAAgE;IAChE,gBAAgB,UAAQ;IAExB;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,WAAW;CAKnC"}
|