scripts / verify-title-live.cjs
const assert = require('node:assert/strict');
const { Chat } = require('@lmstudio/sdk');
const { generate } = require('../dist/generator');
const { TITLE_REQUEST } = require('../dist/titleGeneration');
async function main() {
const abort = new AbortController();
const hostTimeout = setTimeout(() => abort.abort(), 10000);
const events = [];
const start = Date.now();
try {
await generate({
abortSignal: abort.signal,
fragmentGenerated: (text, options) => events.push([text, options]),
getPluginConfig: () => ({ get: key => ({ model: 'strata', thinking: 'high', maxTokens: 32768, thinkingBudget: 8192 })[key] }),
getGlobalPluginConfig: () => ({ get: key => ({ baseUrl: 'http://127.0.0.1:8080/v1', apiKey: '' })[key] }),
getToolDefinitions: () => { throw Error('Unexpected tool access'); },
}, Chat.from([
{ role: 'user', content: 'LM StudioでStrataの画像入力とツールを設定したい' },
{ role: 'assistant', content: '画像入力とツール呼び出しの設定が完了しました。' },
{ role: 'user', content: TITLE_REQUEST },
]));
const elapsedMs = Date.now() - start;
assert.ok(elapsedMs < 9000, `Title took ${elapsedMs} ms`);
assert.equal(events.length, 1);
assert.match(events[0][0], /^<title>[^<>\r\n]+<\/title>$/);
assert.equal(events[0][1].reasoningType, 'none');
console.log(JSON.stringify({ passed: true, elapsedMs, title: events[0][0] }));
} finally { clearTimeout(hostTimeout); }
}
main().catch(error => { console.error(error); process.exitCode = 1; });
scripts / verify-title-live.cjs
const assert = require('node:assert/strict');
const { Chat } = require('@lmstudio/sdk');
const { generate } = require('../dist/generator');
const { TITLE_REQUEST } = require('../dist/titleGeneration');
async function main() {
const abort = new AbortController();
const hostTimeout = setTimeout(() => abort.abort(), 10000);
const events = [];
const start = Date.now();
try {
await generate({
abortSignal: abort.signal,
fragmentGenerated: (text, options) => events.push([text, options]),
getPluginConfig: () => ({ get: key => ({ model: 'strata', thinking: 'high', maxTokens: 32768, thinkingBudget: 8192 })[key] }),
getGlobalPluginConfig: () => ({ get: key => ({ baseUrl: 'http://127.0.0.1:8080/v1', apiKey: '' })[key] }),
getToolDefinitions: () => { throw Error('Unexpected tool access'); },
}, Chat.from([
{ role: 'user', content: 'LM StudioでStrataの画像入力とツールを設定したい' },
{ role: 'assistant', content: '画像入力とツール呼び出しの設定が完了しました。' },
{ role: 'user', content: TITLE_REQUEST },
]));
const elapsedMs = Date.now() - start;
assert.ok(elapsedMs < 9000, `Title took ${elapsedMs} ms`);
assert.equal(events.length, 1);
assert.match(events[0][0], /^<title>[^<>\r\n]+<\/title>$/);
assert.equal(events[0][1].reasoningType, 'none');
console.log(JSON.stringify({ passed: true, elapsedMs, title: events[0][0] }));
} finally { clearTimeout(hostTimeout); }
}
main().catch(error => { console.error(error); process.exitCode = 1; });