All checks were successful
Forgejo Android APK / Build signed APK (push) Successful in 1m47s
27 lines
1.2 KiB
JavaScript
27 lines
1.2 KiB
JavaScript
const { test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const path = require('node:path');
|
|
const { pathToFileURL } = require('node:url');
|
|
|
|
async function imagesModule() {
|
|
return import(pathToFileURL(path.join(__dirname, '..', 'public/js/assistant/images.js')).href);
|
|
}
|
|
|
|
test('assistant image intent does not intercept table retrieval requests', async () => {
|
|
const { isImageRequest } = await imagesModule();
|
|
assert.equal(isImageRequest('can you show me the table?'), false);
|
|
assert.equal(isImageRequest('show me Table 13.1'), false);
|
|
});
|
|
|
|
test('clinical image prompts strip normal, escaped, and footnote citations', async () => {
|
|
const { buildContextualImagePrompt } = await imagesModule();
|
|
const prompt = buildContextualImagePrompt('Create a teaching visual', 'Claim [1], escaped \\[2, 3\\], and footnote [^4].');
|
|
assert.doesNotMatch(prompt, /\[1\]|\\\[2, 3\\\]|\[\^4\]/);
|
|
assert.match(prompt, /Do not include citations/);
|
|
});
|
|
|
|
test('assistant image intent still handles explicit visual requests', async () => {
|
|
const { isImageRequest } = await imagesModule();
|
|
assert.equal(isImageRequest('show me the diagram'), true);
|
|
assert.equal(isImageRequest('create an infographic for asthma'), true);
|
|
});
|