@tstdl/base 0.93.130 → 0.93.131
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.
|
@@ -9,7 +9,7 @@ var DocumentManagementAiService_1;
|
|
|
9
9
|
import { and, isNull as drizzleIsNull, eq, inArray } from 'drizzle-orm';
|
|
10
10
|
import { P, match } from 'ts-pattern';
|
|
11
11
|
import { genkitGenerationOptions, injectGenkit, injectModel } from '../../../ai/genkit/index.js';
|
|
12
|
-
import { buildPrompts, jsonOutputInstructions, orderedList } from '../../../ai/prompts/index.js';
|
|
12
|
+
import { buildPrompts, formatInstructions, jsonOutputInstructions, orderedList } from '../../../ai/prompts/index.js';
|
|
13
13
|
import { inject } from '../../../injector/inject.js';
|
|
14
14
|
import { Logger } from '../../../logger/logger.js';
|
|
15
15
|
import { arrayAgg } from '../../../orm/index.js';
|
|
@@ -497,11 +497,12 @@ export function mergeInstructions(base, overrides, options = {}) {
|
|
|
497
497
|
}
|
|
498
498
|
if (isDefined(override.content)) {
|
|
499
499
|
const strategy = override.strategy ?? 'append';
|
|
500
|
+
const content = isString(override.content) ? override.content : formatInstructions(override.content);
|
|
500
501
|
if (strategy == 'replace') {
|
|
501
|
-
result =
|
|
502
|
+
result = content;
|
|
502
503
|
}
|
|
503
504
|
else {
|
|
504
|
-
result = `${result}\n\n${
|
|
505
|
+
result = `${result}\n\n${content}`;
|
|
505
506
|
}
|
|
506
507
|
}
|
|
507
508
|
}
|
|
@@ -35,4 +35,12 @@ describe('AI Instruction Merging', () => {
|
|
|
35
35
|
const result = mergeInstructions(base, overrides);
|
|
36
36
|
expect(result).toContain('[ID] - [Name]');
|
|
37
37
|
});
|
|
38
|
+
test('should handle Instructions in content', () => {
|
|
39
|
+
const base = 'Base';
|
|
40
|
+
const overrides = [{ content: { Detail: 'More info' }, strategy: 'append' }];
|
|
41
|
+
const result = mergeInstructions(base, overrides);
|
|
42
|
+
expect(result).toContain('Base');
|
|
43
|
+
expect(result).toContain('# Detail');
|
|
44
|
+
expect(result).toContain('More info');
|
|
45
|
+
});
|
|
38
46
|
});
|