React to lmTools API breaking changes (#12866)
This commit is contained in:
Родитель
456af8c7af
Коммит
ad12ca63b0
|
@ -6487,10 +6487,7 @@
|
|||
"userDescription": "%c_cpp.languageModelTools.configuration.userDescription%",
|
||||
"modelDescription": "For the active C or C++ file, this tool provides: the language (C, C++, or CUDA), the language standard version (such as C++11, C++14, C++17, or C++20), the compiler (such as GCC, Clang, or MSVC), the target platform (such as x86, x64, or ARM), and the target architecture (such as 32-bit or 64-bit).",
|
||||
"icon": "$(file-code)",
|
||||
"when": "(config.C_Cpp.experimentalFeatures =~ /^[eE]nabled$/)",
|
||||
"supportedContentTypes": [
|
||||
"text/plain"
|
||||
]
|
||||
"when": "(config.C_Cpp.experimentalFeatures =~ /^[eE]nabled$/)"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -44,15 +44,10 @@ const knownValues: { [Property in keyof ChatContextResult]?: { [id: string]: str
|
|||
}
|
||||
};
|
||||
|
||||
const plainTextContentType = 'text/plain';
|
||||
|
||||
export class CppConfigurationLanguageModelTool implements vscode.LanguageModelTool<void> {
|
||||
public async invoke(options: vscode.LanguageModelToolInvocationOptions<void>, token: vscode.CancellationToken): Promise<vscode.LanguageModelToolResult> {
|
||||
const result: vscode.LanguageModelToolResult = {};
|
||||
if (options.requestedContentTypes.includes(plainTextContentType)) {
|
||||
result[plainTextContentType] = await this.getContext(token);
|
||||
}
|
||||
return result;
|
||||
return new vscode.LanguageModelToolResult([
|
||||
new vscode.LanguageModelTextPart(await this.getContext(token))]);
|
||||
}
|
||||
|
||||
private async getContext(token: vscode.CancellationToken): Promise<string> {
|
||||
|
|
Загрузка…
Ссылка в новой задаче