@semiont/jobs 0.2.46 → 0.3.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/dist/index.d.ts +23 -15
- package/dist/index.js +88 -57
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Readable } from 'stream';
|
|
2
|
-
import { ResourceId, JobId, UserId, EntityType, AnnotationId, components,
|
|
2
|
+
import { ResourceId, JobId, UserId, EntityType, AnnotationId, components, GatheredContext, Logger, EventBus } from '@semiont/core';
|
|
3
3
|
import { InferenceClient } from '@semiont/inference';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -58,7 +58,7 @@ interface GenerationParams {
|
|
|
58
58
|
title?: string;
|
|
59
59
|
entityTypes?: EntityType[];
|
|
60
60
|
language?: string;
|
|
61
|
-
context?:
|
|
61
|
+
context?: GatheredContext;
|
|
62
62
|
temperature?: number;
|
|
63
63
|
maxTokens?: number;
|
|
64
64
|
}
|
|
@@ -439,11 +439,10 @@ interface DetectedAnnotation {
|
|
|
439
439
|
};
|
|
440
440
|
}
|
|
441
441
|
declare class ReferenceAnnotationWorker extends JobWorker {
|
|
442
|
-
private config;
|
|
443
442
|
private inferenceClient;
|
|
444
443
|
private eventBus;
|
|
445
444
|
private contentFetcher;
|
|
446
|
-
constructor(jobQueue: JobQueue,
|
|
445
|
+
constructor(jobQueue: JobQueue, inferenceClient: InferenceClient, eventBus: EventBus, contentFetcher: ContentFetcher, logger: Logger);
|
|
447
446
|
protected getWorkerName(): string;
|
|
448
447
|
protected canProcessJob(job: AnyJob): boolean;
|
|
449
448
|
protected executeJob(job: AnyJob): Promise<DetectionResult>;
|
|
@@ -478,10 +477,9 @@ declare class ReferenceAnnotationWorker extends JobWorker {
|
|
|
478
477
|
*/
|
|
479
478
|
|
|
480
479
|
declare class GenerationWorker extends JobWorker {
|
|
481
|
-
private config;
|
|
482
480
|
private inferenceClient;
|
|
483
481
|
private eventBus;
|
|
484
|
-
constructor(jobQueue: JobQueue,
|
|
482
|
+
constructor(jobQueue: JobQueue, inferenceClient: InferenceClient, eventBus: EventBus, logger: Logger);
|
|
485
483
|
protected getWorkerName(): string;
|
|
486
484
|
protected canProcessJob(job: AnyJob): boolean;
|
|
487
485
|
protected executeJob(job: AnyJob): Promise<GenerationResult>;
|
|
@@ -507,12 +505,11 @@ declare class GenerationWorker extends JobWorker {
|
|
|
507
505
|
*/
|
|
508
506
|
|
|
509
507
|
declare class HighlightAnnotationWorker extends JobWorker {
|
|
510
|
-
private config;
|
|
511
508
|
private inferenceClient;
|
|
512
509
|
private eventBus;
|
|
513
510
|
private contentFetcher;
|
|
514
511
|
private isFirstProgress;
|
|
515
|
-
constructor(jobQueue: JobQueue,
|
|
512
|
+
constructor(jobQueue: JobQueue, inferenceClient: InferenceClient, eventBus: EventBus, contentFetcher: ContentFetcher, logger: Logger);
|
|
516
513
|
protected getWorkerName(): string;
|
|
517
514
|
protected canProcessJob(job: AnyJob): boolean;
|
|
518
515
|
protected executeJob(job: AnyJob): Promise<HighlightDetectionResult>;
|
|
@@ -538,12 +535,11 @@ declare class HighlightAnnotationWorker extends JobWorker {
|
|
|
538
535
|
*/
|
|
539
536
|
|
|
540
537
|
declare class AssessmentAnnotationWorker extends JobWorker {
|
|
541
|
-
private config;
|
|
542
538
|
private inferenceClient;
|
|
543
539
|
private eventBus;
|
|
544
540
|
private contentFetcher;
|
|
545
541
|
private isFirstProgress;
|
|
546
|
-
constructor(jobQueue: JobQueue,
|
|
542
|
+
constructor(jobQueue: JobQueue, inferenceClient: InferenceClient, eventBus: EventBus, contentFetcher: ContentFetcher, logger: Logger);
|
|
547
543
|
protected getWorkerName(): string;
|
|
548
544
|
protected canProcessJob(job: AnyJob): boolean;
|
|
549
545
|
protected executeJob(job: AnyJob): Promise<AssessmentDetectionResult>;
|
|
@@ -569,12 +565,11 @@ declare class AssessmentAnnotationWorker extends JobWorker {
|
|
|
569
565
|
*/
|
|
570
566
|
|
|
571
567
|
declare class CommentAnnotationWorker extends JobWorker {
|
|
572
|
-
private config;
|
|
573
568
|
private inferenceClient;
|
|
574
569
|
private eventBus;
|
|
575
570
|
private contentFetcher;
|
|
576
571
|
private isFirstProgress;
|
|
577
|
-
constructor(jobQueue: JobQueue,
|
|
572
|
+
constructor(jobQueue: JobQueue, inferenceClient: InferenceClient, eventBus: EventBus, contentFetcher: ContentFetcher, logger: Logger);
|
|
578
573
|
protected getWorkerName(): string;
|
|
579
574
|
protected canProcessJob(job: AnyJob): boolean;
|
|
580
575
|
protected executeJob(job: AnyJob): Promise<CommentDetectionResult>;
|
|
@@ -601,12 +596,11 @@ declare class CommentAnnotationWorker extends JobWorker {
|
|
|
601
596
|
*/
|
|
602
597
|
|
|
603
598
|
declare class TagAnnotationWorker extends JobWorker {
|
|
604
|
-
private config;
|
|
605
599
|
private inferenceClient;
|
|
606
600
|
private eventBus;
|
|
607
601
|
private contentFetcher;
|
|
608
602
|
private isFirstProgress;
|
|
609
|
-
constructor(jobQueue: JobQueue,
|
|
603
|
+
constructor(jobQueue: JobQueue, inferenceClient: InferenceClient, eventBus: EventBus, contentFetcher: ContentFetcher, logger: Logger);
|
|
610
604
|
protected getWorkerName(): string;
|
|
611
605
|
protected canProcessJob(job: AnyJob): boolean;
|
|
612
606
|
protected executeJob(job: AnyJob): Promise<TagDetectionResult>;
|
|
@@ -714,4 +708,18 @@ declare class AnnotationDetection {
|
|
|
714
708
|
static detectTags(content: string, client: InferenceClient, schemaId: string, category: string): Promise<TagMatch[]>;
|
|
715
709
|
}
|
|
716
710
|
|
|
717
|
-
|
|
711
|
+
/**
|
|
712
|
+
* Resource Generation
|
|
713
|
+
*
|
|
714
|
+
* Generates markdown resources from topics using AI inference.
|
|
715
|
+
*/
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Generate resource content using inference
|
|
719
|
+
*/
|
|
720
|
+
declare function generateResourceFromTopic(topic: string, entityTypes: string[], client: InferenceClient, userPrompt?: string, locale?: string, context?: GatheredContext, temperature?: number, maxTokens?: number, logger?: Logger): Promise<{
|
|
721
|
+
title: string;
|
|
722
|
+
content: string;
|
|
723
|
+
}>;
|
|
724
|
+
|
|
725
|
+
export { AnnotationDetection, type AnyJob, AssessmentAnnotationWorker, type AssessmentDetectionJob, type AssessmentDetectionParams, type AssessmentDetectionProgress, type AssessmentDetectionResult, type CancelledJob, CommentAnnotationWorker, type CommentDetectionJob, type CommentDetectionParams, type CommentDetectionProgress, type CommentDetectionResult, type CompleteJob, type ContentFetcher, type DetectionJob, type DetectionParams, type DetectionProgress, type DetectionResult, type FailedJob, type GenerationJob, type GenerationParams, type GenerationResult, GenerationWorker, HighlightAnnotationWorker, type HighlightDetectionJob, type HighlightDetectionParams, type HighlightDetectionProgress, type HighlightDetectionResult, type JobMetadata, type JobQueryFilters, JobQueue, type JobQueueConfig, type JobStatus, type JobType, JobWorker, type PendingJob, ReferenceAnnotationWorker, type RunningJob, TagAnnotationWorker, type TagDetectionJob, type TagDetectionParams, type TagDetectionProgress, type TagDetectionResult, type YieldProgress, generateResourceFromTopic, getJobQueue, initializeJobQueue, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { promises, watch } from 'fs';
|
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import { validateAndCorrectOffsets, getTargetSelector, getExactText, getLocaleEnglishName } from '@semiont/api-client';
|
|
4
4
|
import { generateAnnotationId } from '@semiont/event-sourcing';
|
|
5
|
-
import { userToAgent,
|
|
5
|
+
import { userToAgent, userId, jobId, CREATION_METHODS, annotationId } from '@semiont/core';
|
|
6
6
|
|
|
7
7
|
var __create = Object.create;
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
@@ -11083,9 +11083,8 @@ Example output:
|
|
|
11083
11083
|
|
|
11084
11084
|
// src/workers/reference-annotation-worker.ts
|
|
11085
11085
|
var ReferenceAnnotationWorker = class extends JobWorker {
|
|
11086
|
-
constructor(jobQueue2,
|
|
11086
|
+
constructor(jobQueue2, inferenceClient, eventBus, contentFetcher, logger) {
|
|
11087
11087
|
super(jobQueue2, void 0, void 0, logger);
|
|
11088
|
-
this.config = config;
|
|
11089
11088
|
this.inferenceClient = inferenceClient;
|
|
11090
11089
|
this.eventBus = eventBus;
|
|
11091
11090
|
this.contentFetcher = contentFetcher;
|
|
@@ -11188,17 +11187,7 @@ var ReferenceAnnotationWorker = class extends JobWorker {
|
|
|
11188
11187
|
this.logger?.warn("Skipping undefined entity", { index: idx });
|
|
11189
11188
|
continue;
|
|
11190
11189
|
}
|
|
11191
|
-
|
|
11192
|
-
try {
|
|
11193
|
-
const backendUrl = this.config.services.backend?.publicURL;
|
|
11194
|
-
if (!backendUrl) {
|
|
11195
|
-
throw new Error("Backend publicURL not configured");
|
|
11196
|
-
}
|
|
11197
|
-
referenceId = generateAnnotationId(backendUrl);
|
|
11198
|
-
} catch (error) {
|
|
11199
|
-
this.logger?.error("Failed to generate annotation ID", { error });
|
|
11200
|
-
throw new Error("Configuration error: Backend publicURL not set");
|
|
11201
|
-
}
|
|
11190
|
+
const referenceId = generateAnnotationId();
|
|
11202
11191
|
try {
|
|
11203
11192
|
const creator = userToAgent({
|
|
11204
11193
|
id: job.metadata.userId,
|
|
@@ -11214,8 +11203,7 @@ var ReferenceAnnotationWorker = class extends JobWorker {
|
|
|
11214
11203
|
creator,
|
|
11215
11204
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11216
11205
|
target: {
|
|
11217
|
-
source:
|
|
11218
|
-
// Convert to full URI
|
|
11206
|
+
source: job.params.resourceId,
|
|
11219
11207
|
selector: [
|
|
11220
11208
|
{
|
|
11221
11209
|
type: "TextPositionSelector",
|
|
@@ -11385,11 +11373,38 @@ function getLanguageName(locale) {
|
|
|
11385
11373
|
return getLocaleEnglishName(locale) || locale;
|
|
11386
11374
|
}
|
|
11387
11375
|
async function generateResourceFromTopic(topic, entityTypes, client, userPrompt, locale, context, temperature, maxTokens, logger) {
|
|
11376
|
+
logger?.debug("Generating resource from topic", {
|
|
11377
|
+
topicPreview: topic.substring(0, 100),
|
|
11378
|
+
entityTypes,
|
|
11379
|
+
hasUserPrompt: !!userPrompt,
|
|
11380
|
+
locale,
|
|
11381
|
+
hasContext: !!context,
|
|
11382
|
+
temperature,
|
|
11383
|
+
maxTokens
|
|
11384
|
+
});
|
|
11388
11385
|
const finalTemperature = temperature ?? 0.7;
|
|
11389
11386
|
const finalMaxTokens = maxTokens ?? 500;
|
|
11390
11387
|
const languageInstruction = locale && locale !== "en" ? `
|
|
11391
11388
|
|
|
11392
11389
|
IMPORTANT: Write the entire resource in ${getLanguageName(locale)}.` : "";
|
|
11390
|
+
let annotationSection = "";
|
|
11391
|
+
if (context) {
|
|
11392
|
+
const parts = [];
|
|
11393
|
+
parts.push(`- Annotation motivation: ${context.annotation.motivation}`);
|
|
11394
|
+
parts.push(`- Source resource: ${context.sourceResource.name}`);
|
|
11395
|
+
const { motivation, body } = context.annotation;
|
|
11396
|
+
if (motivation === "commenting" || motivation === "assessing") {
|
|
11397
|
+
const bodyItem = Array.isArray(body) ? body[0] : body;
|
|
11398
|
+
if (bodyItem && "value" in bodyItem && bodyItem.value) {
|
|
11399
|
+
const label = motivation === "commenting" ? "Comment" : "Assessment";
|
|
11400
|
+
parts.push(`- ${label}: ${bodyItem.value}`);
|
|
11401
|
+
}
|
|
11402
|
+
}
|
|
11403
|
+
annotationSection = `
|
|
11404
|
+
|
|
11405
|
+
Annotation context:
|
|
11406
|
+
${parts.join("\n")}`;
|
|
11407
|
+
}
|
|
11393
11408
|
let contextSection = "";
|
|
11394
11409
|
if (context?.sourceContext) {
|
|
11395
11410
|
const { before, selected, after } = context.sourceContext;
|
|
@@ -11403,9 +11418,36 @@ ${after ? `${after}...` : ""}
|
|
|
11403
11418
|
---
|
|
11404
11419
|
`;
|
|
11405
11420
|
}
|
|
11421
|
+
let graphContextSection = "";
|
|
11422
|
+
if (context?.graphContext) {
|
|
11423
|
+
const gc = context.graphContext;
|
|
11424
|
+
const connections = gc.connections ?? [];
|
|
11425
|
+
const citedBy = gc.citedBy ?? [];
|
|
11426
|
+
const parts = [];
|
|
11427
|
+
if (connections.length > 0) {
|
|
11428
|
+
const connList = connections.map((c) => `${c.resourceName}${c.entityTypes?.length ? ` (${c.entityTypes.join(", ")})` : ""}`).join(", ");
|
|
11429
|
+
parts.push(`- Connected resources: ${connList}`);
|
|
11430
|
+
}
|
|
11431
|
+
if (gc.citedByCount && gc.citedByCount > 0) {
|
|
11432
|
+
const citedNames = citedBy.map((c) => c.resourceName).join(", ");
|
|
11433
|
+
parts.push(`- This resource is cited by ${gc.citedByCount} other resource${gc.citedByCount > 1 ? "s" : ""}${citedNames ? `: ${citedNames}` : ""}`);
|
|
11434
|
+
}
|
|
11435
|
+
if (gc.siblingEntityTypes && gc.siblingEntityTypes.length > 0) {
|
|
11436
|
+
parts.push(`- Related entity types in this document: ${gc.siblingEntityTypes.join(", ")}`);
|
|
11437
|
+
}
|
|
11438
|
+
if (gc.inferredRelationshipSummary) {
|
|
11439
|
+
parts.push(`- Relationship summary: ${gc.inferredRelationshipSummary}`);
|
|
11440
|
+
}
|
|
11441
|
+
if (parts.length > 0) {
|
|
11442
|
+
graphContextSection = `
|
|
11443
|
+
|
|
11444
|
+
Knowledge graph context:
|
|
11445
|
+
${parts.join("\n")}`;
|
|
11446
|
+
}
|
|
11447
|
+
}
|
|
11406
11448
|
const prompt = `Generate a concise, informative resource about "${topic}".
|
|
11407
11449
|
${entityTypes.length > 0 ? `Focus on these entity types: ${entityTypes.join(", ")}.` : ""}
|
|
11408
|
-
${userPrompt ? `Additional context: ${userPrompt}` : ""}${contextSection}${languageInstruction}
|
|
11450
|
+
${userPrompt ? `Additional context: ${userPrompt}` : ""}${annotationSection}${contextSection}${graphContextSection}${languageInstruction}
|
|
11409
11451
|
|
|
11410
11452
|
Requirements:
|
|
11411
11453
|
- Start with a clear heading (# Title)
|
|
@@ -11434,16 +11476,27 @@ Requirements:
|
|
|
11434
11476
|
content
|
|
11435
11477
|
};
|
|
11436
11478
|
};
|
|
11479
|
+
logger?.debug("Sending prompt to inference", {
|
|
11480
|
+
promptLength: prompt.length,
|
|
11481
|
+
temperature: finalTemperature,
|
|
11482
|
+
maxTokens: finalMaxTokens
|
|
11483
|
+
});
|
|
11437
11484
|
const response = await client.generateText(prompt, finalMaxTokens, finalTemperature);
|
|
11485
|
+
logger?.debug("Got response from inference", { responseLength: response.length });
|
|
11438
11486
|
const result = parseResponse(response);
|
|
11487
|
+
logger?.debug("Parsed response", {
|
|
11488
|
+
hasTitle: !!result.title,
|
|
11489
|
+
titleLength: result.title?.length,
|
|
11490
|
+
hasContent: !!result.content,
|
|
11491
|
+
contentLength: result.content?.length
|
|
11492
|
+
});
|
|
11439
11493
|
return result;
|
|
11440
11494
|
}
|
|
11441
11495
|
var import_rxjs = __toESM(require_cjs());
|
|
11442
11496
|
var import_operators = __toESM(require_operators());
|
|
11443
11497
|
var GenerationWorker = class extends JobWorker {
|
|
11444
|
-
constructor(jobQueue2,
|
|
11498
|
+
constructor(jobQueue2, inferenceClient, eventBus, logger) {
|
|
11445
11499
|
super(jobQueue2, void 0, void 0, logger);
|
|
11446
|
-
this.config = config;
|
|
11447
11500
|
this.inferenceClient = inferenceClient;
|
|
11448
11501
|
this.eventBus = eventBus;
|
|
11449
11502
|
}
|
|
@@ -11562,18 +11615,16 @@ var GenerationWorker = class extends JobWorker {
|
|
|
11562
11615
|
};
|
|
11563
11616
|
this.logger?.debug("Generation progress", { stage: updatedJob.progress.stage, message: updatedJob.progress.message });
|
|
11564
11617
|
await this.updateJobProgress(updatedJob);
|
|
11565
|
-
const newResourceUri = resourceUri(`${this.config.services.backend.publicURL}/resources/${rId}`);
|
|
11566
11618
|
const operations = [{
|
|
11567
11619
|
op: "add",
|
|
11568
11620
|
item: {
|
|
11569
11621
|
type: "SpecificResource",
|
|
11570
|
-
source:
|
|
11622
|
+
source: rId,
|
|
11571
11623
|
purpose: "linking"
|
|
11572
11624
|
}
|
|
11573
11625
|
}];
|
|
11574
|
-
const annotationIdSegment = job.params.referenceId.split("/").pop();
|
|
11575
11626
|
this.eventBus.get("mark:update-body").next({
|
|
11576
|
-
annotationId: annotationId(
|
|
11627
|
+
annotationId: annotationId(job.params.referenceId),
|
|
11577
11628
|
userId: userId(job.metadata.userId),
|
|
11578
11629
|
resourceId: job.params.sourceResourceId,
|
|
11579
11630
|
operations
|
|
@@ -11609,7 +11660,7 @@ var GenerationWorker = class extends JobWorker {
|
|
|
11609
11660
|
jobType: "generation",
|
|
11610
11661
|
result: {
|
|
11611
11662
|
resultResourceId: result.resourceId,
|
|
11612
|
-
|
|
11663
|
+
annotationId: job.params.referenceId
|
|
11613
11664
|
}
|
|
11614
11665
|
});
|
|
11615
11666
|
}
|
|
@@ -11670,9 +11721,8 @@ var GenerationWorker = class extends JobWorker {
|
|
|
11670
11721
|
}
|
|
11671
11722
|
};
|
|
11672
11723
|
var HighlightAnnotationWorker = class extends JobWorker {
|
|
11673
|
-
constructor(jobQueue2,
|
|
11724
|
+
constructor(jobQueue2, inferenceClient, eventBus, contentFetcher, logger) {
|
|
11674
11725
|
super(jobQueue2, void 0, void 0, logger);
|
|
11675
|
-
this.config = config;
|
|
11676
11726
|
this.inferenceClient = inferenceClient;
|
|
11677
11727
|
this.eventBus = eventBus;
|
|
11678
11728
|
this.contentFetcher = contentFetcher;
|
|
@@ -11820,10 +11870,7 @@ var HighlightAnnotationWorker = class extends JobWorker {
|
|
|
11820
11870
|
};
|
|
11821
11871
|
}
|
|
11822
11872
|
async createHighlightAnnotation(resourceId, metadata, highlight) {
|
|
11823
|
-
const
|
|
11824
|
-
if (!backendUrl) throw new Error("Backend publicURL not configured");
|
|
11825
|
-
const annotationIdVal = generateAnnotationId(backendUrl);
|
|
11826
|
-
const resourceUri2 = resourceIdToURI(resourceId, backendUrl);
|
|
11873
|
+
const annotationIdVal = generateAnnotationId();
|
|
11827
11874
|
const creator = userToAgent({
|
|
11828
11875
|
id: metadata.userId,
|
|
11829
11876
|
name: metadata.userName,
|
|
@@ -11839,7 +11886,7 @@ var HighlightAnnotationWorker = class extends JobWorker {
|
|
|
11839
11886
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11840
11887
|
"target": {
|
|
11841
11888
|
type: "SpecificResource",
|
|
11842
|
-
source:
|
|
11889
|
+
source: resourceId,
|
|
11843
11890
|
selector: [
|
|
11844
11891
|
{
|
|
11845
11892
|
type: "TextPositionSelector",
|
|
@@ -11865,9 +11912,8 @@ var HighlightAnnotationWorker = class extends JobWorker {
|
|
|
11865
11912
|
}
|
|
11866
11913
|
};
|
|
11867
11914
|
var AssessmentAnnotationWorker = class extends JobWorker {
|
|
11868
|
-
constructor(jobQueue2,
|
|
11915
|
+
constructor(jobQueue2, inferenceClient, eventBus, contentFetcher, logger) {
|
|
11869
11916
|
super(jobQueue2, void 0, void 0, logger);
|
|
11870
|
-
this.config = config;
|
|
11871
11917
|
this.inferenceClient = inferenceClient;
|
|
11872
11918
|
this.eventBus = eventBus;
|
|
11873
11919
|
this.contentFetcher = contentFetcher;
|
|
@@ -12016,10 +12062,7 @@ var AssessmentAnnotationWorker = class extends JobWorker {
|
|
|
12016
12062
|
};
|
|
12017
12063
|
}
|
|
12018
12064
|
async createAssessmentAnnotation(resourceId, metadata, assessment) {
|
|
12019
|
-
const
|
|
12020
|
-
if (!backendUrl) throw new Error("Backend publicURL not configured");
|
|
12021
|
-
const annotationIdVal = generateAnnotationId(backendUrl);
|
|
12022
|
-
const resourceUri2 = resourceIdToURI(resourceId, backendUrl);
|
|
12065
|
+
const annotationIdVal = generateAnnotationId();
|
|
12023
12066
|
const creator = userToAgent({
|
|
12024
12067
|
id: metadata.userId,
|
|
12025
12068
|
name: metadata.userName,
|
|
@@ -12035,7 +12078,7 @@ var AssessmentAnnotationWorker = class extends JobWorker {
|
|
|
12035
12078
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12036
12079
|
"target": {
|
|
12037
12080
|
type: "SpecificResource",
|
|
12038
|
-
source:
|
|
12081
|
+
source: resourceId,
|
|
12039
12082
|
selector: [
|
|
12040
12083
|
{
|
|
12041
12084
|
type: "TextPositionSelector",
|
|
@@ -12064,9 +12107,8 @@ var AssessmentAnnotationWorker = class extends JobWorker {
|
|
|
12064
12107
|
}
|
|
12065
12108
|
};
|
|
12066
12109
|
var CommentAnnotationWorker = class extends JobWorker {
|
|
12067
|
-
constructor(jobQueue2,
|
|
12110
|
+
constructor(jobQueue2, inferenceClient, eventBus, contentFetcher, logger) {
|
|
12068
12111
|
super(jobQueue2, void 0, void 0, logger);
|
|
12069
|
-
this.config = config;
|
|
12070
12112
|
this.inferenceClient = inferenceClient;
|
|
12071
12113
|
this.eventBus = eventBus;
|
|
12072
12114
|
this.contentFetcher = contentFetcher;
|
|
@@ -12215,12 +12257,7 @@ var CommentAnnotationWorker = class extends JobWorker {
|
|
|
12215
12257
|
};
|
|
12216
12258
|
}
|
|
12217
12259
|
async createCommentAnnotation(resourceId, metadata, comment) {
|
|
12218
|
-
const
|
|
12219
|
-
if (!backendUrl) {
|
|
12220
|
-
throw new Error("Backend publicURL not configured");
|
|
12221
|
-
}
|
|
12222
|
-
const resourceUri2 = resourceIdToURI(resourceId, backendUrl);
|
|
12223
|
-
const annotationIdVal = generateAnnotationId(backendUrl);
|
|
12260
|
+
const annotationIdVal = generateAnnotationId();
|
|
12224
12261
|
const creator = userToAgent({
|
|
12225
12262
|
id: metadata.userId,
|
|
12226
12263
|
name: metadata.userName,
|
|
@@ -12236,7 +12273,7 @@ var CommentAnnotationWorker = class extends JobWorker {
|
|
|
12236
12273
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12237
12274
|
target: {
|
|
12238
12275
|
type: "SpecificResource",
|
|
12239
|
-
source:
|
|
12276
|
+
source: resourceId,
|
|
12240
12277
|
selector: [
|
|
12241
12278
|
{
|
|
12242
12279
|
type: "TextPositionSelector",
|
|
@@ -12273,9 +12310,8 @@ var CommentAnnotationWorker = class extends JobWorker {
|
|
|
12273
12310
|
}
|
|
12274
12311
|
};
|
|
12275
12312
|
var TagAnnotationWorker = class extends JobWorker {
|
|
12276
|
-
constructor(jobQueue2,
|
|
12313
|
+
constructor(jobQueue2, inferenceClient, eventBus, contentFetcher, logger) {
|
|
12277
12314
|
super(jobQueue2, void 0, void 0, logger);
|
|
12278
|
-
this.config = config;
|
|
12279
12315
|
this.inferenceClient = inferenceClient;
|
|
12280
12316
|
this.eventBus = eventBus;
|
|
12281
12317
|
this.contentFetcher = contentFetcher;
|
|
@@ -12456,12 +12492,7 @@ var TagAnnotationWorker = class extends JobWorker {
|
|
|
12456
12492
|
};
|
|
12457
12493
|
}
|
|
12458
12494
|
async createTagAnnotation(resourceId, metadata, schemaId, tag) {
|
|
12459
|
-
const
|
|
12460
|
-
if (!backendUrl) {
|
|
12461
|
-
throw new Error("Backend publicURL not configured");
|
|
12462
|
-
}
|
|
12463
|
-
const resourceUri2 = resourceIdToURI(resourceId, backendUrl);
|
|
12464
|
-
const annotationIdVal = generateAnnotationId(backendUrl);
|
|
12495
|
+
const annotationIdVal = generateAnnotationId();
|
|
12465
12496
|
const creator = userToAgent({
|
|
12466
12497
|
id: metadata.userId,
|
|
12467
12498
|
name: metadata.userName,
|
|
@@ -12477,7 +12508,7 @@ var TagAnnotationWorker = class extends JobWorker {
|
|
|
12477
12508
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12478
12509
|
target: {
|
|
12479
12510
|
type: "SpecificResource",
|
|
12480
|
-
source:
|
|
12511
|
+
source: resourceId,
|
|
12481
12512
|
selector: [
|
|
12482
12513
|
{
|
|
12483
12514
|
type: "TextPositionSelector",
|
|
@@ -12521,6 +12552,6 @@ var TagAnnotationWorker = class extends JobWorker {
|
|
|
12521
12552
|
}
|
|
12522
12553
|
};
|
|
12523
12554
|
|
|
12524
|
-
export { AnnotationDetection, AssessmentAnnotationWorker, CommentAnnotationWorker, GenerationWorker, HighlightAnnotationWorker, JobQueue, JobWorker, ReferenceAnnotationWorker, TagAnnotationWorker, getJobQueue, initializeJobQueue, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob };
|
|
12555
|
+
export { AnnotationDetection, AssessmentAnnotationWorker, CommentAnnotationWorker, GenerationWorker, HighlightAnnotationWorker, JobQueue, JobWorker, ReferenceAnnotationWorker, TagAnnotationWorker, generateResourceFromTopic, getJobQueue, initializeJobQueue, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob };
|
|
12525
12556
|
//# sourceMappingURL=index.js.map
|
|
12526
12557
|
//# sourceMappingURL=index.js.map
|