mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-10 16:49:36 +01:00
333d9a4053
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
40 lines
2.0 KiB
TypeScript
40 lines
2.0 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
import * as fs from 'fs';
|
|
import '../../src/extension/intents/node/allIntents'; // make sure all intents are registered
|
|
import { ChatLocation } from '../../src/platform/chat/common/commonTypes';
|
|
import { join } from '../../src/util/vs/base/common/path';
|
|
import { ssuite } from '../base/stest';
|
|
import { generateIntentTest } from './intentTest';
|
|
|
|
ssuite({ title: 'intent', location: 'panel' }, () => {
|
|
runAdditionalCases(join(__dirname, '../test/intent/panel-chat.json'));
|
|
// Uncomment this line to run additional intent detection tests
|
|
// runAdditionalCases(join(__dirname, '../test/intent/panel-chat-github.json'));
|
|
// runAdditionalCases(join(__dirname, '../test/intent/panel-chat-unknown.json'));
|
|
});
|
|
|
|
function runAdditionalCases(sourceFile: string) {
|
|
const additionalCases = JSON.parse(fs.readFileSync(sourceFile, { encoding: 'utf8' }));
|
|
if (additionalCases && Array.isArray(additionalCases)) {
|
|
additionalCases.forEach((testCase: any) => {
|
|
if (typeof testCase === 'object' && !!testCase && testCase['Location'] === 'panel') {
|
|
const query = testCase['Request'];
|
|
const expectedIntent = testCase['Intent'];
|
|
for (const strictMode of [true, false]) {
|
|
generateIntentTest({
|
|
location: ChatLocation.Panel,
|
|
name: (strictMode ? '[strict] ' : '[relaxed] ') + `[${expectedIntent === 'github' ? 'github' : 'builtin'}] ` + query,
|
|
query,
|
|
expectedIntent: (['workspace', 'vscode', 'new', 'newNotebook', 'unknown', 'tests', 'setupTests', 'terminalExplain', 'github.copilot-dynamic.platform'].includes(expectedIntent)
|
|
? (strictMode ? expectedIntent : [expectedIntent, 'unknown'])
|
|
: 'unknown'),
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|