Skip to content

Commit bbb0208

Browse files
authored
Task: reorganize questions (#5367)
1 parent b5eeeb5 commit bbb0208

File tree

6 files changed

+64
-30
lines changed

6 files changed

+64
-30
lines changed

vscode/microsoft-kiota/l10n/bundle.l10n.it.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,10 @@
7878
"Migration completed, but no changes were detected.":"Migrazione completa, nessuna modifica rilevata.",
7979
"Migration failed":"Migrazione fallita",
8080
"API clients migrated successfully!":"Client API migrati con successo!",
81-
"Could not determine the workspace folder.": "Impossibile determinare la cartella di lavoro."
81+
"Could not determine the workspace folder.": "Impossibile determinare la cartella di lavoro.",
82+
"Client": "Cliente",
83+
"Copilot plugin": "Plugin Copilot",
84+
"Other": "Altro",
85+
"Create a new OpenAI plugin": "Crea un nuovo plugin OpenAI",
86+
"Choose a name for the OpenAI plugin": "Scegli un nome per il plugin OpenAI"
8287
}

vscode/microsoft-kiota/l10n/bundle.l10n.pl.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,10 @@
7878
"Migration completed, but no changes were detected.":"Migracja zakończona, ale nie wykryto żadnych zmian.",
7979
"Migration failed":"Migracja nie powiodła się.",
8080
"API clients migrated successfully!":"Klienci API zostali pomyślnie przeniesieni!",
81-
"Could not determine the workspace folder.": "Nie można określić folderu przestrzeni roboczej."
81+
"Could not determine the workspace folder.": "Nie można określić folderu przestrzeni roboczej.",
82+
"Client": "Klient",
83+
"Copilot plugin": "Plugin Copilot",
84+
"Other": "Inne",
85+
"Create a new OpenAI plugin": "Utwórz nowy plugin OpenAI",
86+
"Choose a name for the OpenAI plugin": "Wybierz nazwę dla pluginu OpenAI"
8287
}

vscode/microsoft-kiota/l10n/bundle.l10n.ru.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,10 @@
7676
"Migration completed, but no changes were detected.":"Миграция завершена, но изменения не обнаружены.",
7777
"Migration failed":"Миграция не удалась",
7878
"API clients migrated successfully!" : "Клиенты API успешно перенесены!",
79-
"Could not determine the workspace folder.": "Не удалось определить папку рабочего пространства."
79+
"Could not determine the workspace folder.": "Не удалось определить папку рабочего пространства.",
80+
"Client": "Клиент",
81+
"Copilot plugin": "Плагин Copilot",
82+
"Other": "Другое",
83+
"Create a new OpenAI plugin": "Создать новый плагин OpenAI",
84+
"Choose a name for the OpenAI plugin": "Выберите название для плагина OpenA"
8085
}

vscode/microsoft-kiota/l10n/bundle.l10n.zh-cn.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,10 @@
7777
"Migration completed, but no changes were detected.":"迁移已完成,但未检测到任何更改",
7878
"Migration failed":"迁移失败",
7979
"API clients migrated successfully!":"Api客户端迁移成功!",
80-
"Could not determine the workspace folder.": "无法确定工作区文件夹"
80+
"Could not determine the workspace folder.": "无法确定工作区文件夹",
81+
"Client": "客户",
82+
"Copilot plugin": "Copilot插件",
83+
"Other": "其他",
84+
"Create a new OpenAI plugin": "创建一个新的 OpenAI 插件",
85+
"Choose a name for the OpenAI plugin": "为 OpenAI 插件选择一个名称"
8186
}

vscode/microsoft-kiota/src/steps.ts

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,19 @@ export async function generateSteps(existingConfiguration: Partial<GenerateState
161161
return inputClientClassName;
162162
case 'plugin':
163163
return inputPluginName;
164-
case 'apimanifest':
165-
return inputManifestName;
164+
case 'other':
165+
return chooseOtherGenerationType;
166166
default:
167167
throw new Error('unknown generation type');
168168
}
169169
}
170170
async function inputGenerationType(input: MultiStepInput, state: Partial<GenerateState>) {
171171
if (!isDeepLinkGenerationTypeProvided) {
172-
const items = [l10n.t('Generate an API client'), l10n.t('Generate a plugin'), l10n.t('Generate an API manifest')];
172+
const items = [
173+
l10n.t('Client'),
174+
l10n.t('Copilot plugin'),
175+
l10n.t('Other')
176+
];
173177
const option = await input.showQuickPick({
174178
title: l10n.t('What do you want to generate?'),
175179
step: step++,
@@ -179,14 +183,14 @@ export async function generateSteps(existingConfiguration: Partial<GenerateState
179183
validate: validateIsNotEmpty,
180184
shouldResume: shouldResume
181185
});
182-
if (option.label === l10n.t('Generate an API client')) {
186+
if (option.label === l10n.t('Client')) {
183187
state.generationType = "client";
184188
}
185-
else if (option.label === l10n.t('Generate a plugin')) {
189+
else if (option.label === l10n.t('Copilot plugin')) {
186190
state.generationType = "plugin";
187191
}
188-
else if (option.label === l10n.t('Generate an API manifest')) {
189-
state.generationType = "apimanifest";
192+
else if (option.label === l10n.t('Other')) {
193+
state.generationType = "other";
190194
}
191195
}
192196
let nextStep = getNextStepForGenerationType(state.generationType?.toString() || '');
@@ -287,32 +291,37 @@ export async function generateSteps(existingConfiguration: Partial<GenerateState
287291
state.pluginName = await input.showInputBox({
288292
title: `${l10n.t('Create a new plugin')} - ${l10n.t('plugin name')}`,
289293
step: step++,
290-
totalSteps: 4,
294+
totalSteps: 3,
291295
value: state.pluginName ?? '',
292296
placeholder: 'MyPlugin',
293297
prompt: l10n.t('Choose a name for the plugin'),
294298
validate: validateIsNotEmpty,
295299
shouldResume: shouldResume
296300
});
297301
}
302+
state.pluginTypes = ['ApiPlugin'];
298303
updateWorkspaceFolder(state.pluginName);
299-
return (input: MultiStepInput) => inputPluginType(input, state);
304+
return (input: MultiStepInput) => inputPluginOutputPath(input, state);
300305
}
301-
async function inputPluginType(input: MultiStepInput, state: Partial<GenerateState>) {
306+
async function chooseOtherGenerationType(input: MultiStepInput, state: Partial<GenerateState>) {
302307
if (!isDeepLinkPluginTypeProvided) {
303-
const items = ['API Plugin', 'Open AI'].map(x => ({ label: x }) as QuickPickItem);
308+
const items = ['API Manifest', 'Open AI Plugin'].map(x => ({ label: x }) as QuickPickItem);
304309
const pluginTypes = await input.showQuickPick({
305-
title: l10n.t('Choose a plugin type'),
310+
title: l10n.t('Choose a type'),
306311
step: step++,
307312
totalSteps: 4,
308313
placeholder: l10n.t('Select an option'),
309314
items: items,
310315
validate: validateIsNotEmpty,
311316
shouldResume: shouldResume
312317
});
313-
pluginTypes.label === 'API Plugin' ? state.pluginTypes = ['ApiPlugin'] : state.pluginTypes = ['OpenAI'];
318+
pluginTypes.label === 'API Manifest' ? state.pluginTypes = ['ApiManifest'] : state.pluginTypes = ['OpenAI'];
319+
314320
}
315-
return (input: MultiStepInput) => inputPluginOutputPath(input, state);
321+
322+
Array.isArray(state.pluginTypes) && state.pluginTypes.includes('ApiManifest') ?
323+
state.generationType = 'apimanifest' : state.generationType = 'plugin';
324+
return (input: MultiStepInput) => inputOtherGenerationTypeName(input, state);
316325
}
317326
async function inputPluginOutputPath(input: MultiStepInput, state: Partial<GenerateState>) {
318327
while (!isDeepLinkOutputPathProvided) {
@@ -351,28 +360,31 @@ export async function generateSteps(existingConfiguration: Partial<GenerateState
351360
break;
352361
}
353362
}
354-
async function inputManifestName(input: MultiStepInput, state: Partial<GenerateState>) {
363+
async function inputOtherGenerationTypeName(input: MultiStepInput, state: Partial<GenerateState>) {
355364
if (!isDeepLinkPluginNameProvided) {
365+
const isManifest = state.pluginTypes && Array.isArray(state.pluginTypes) && state.pluginTypes.includes('ApiManifest');
356366
state.pluginName = await input.showInputBox({
357-
title: `${l10n.t('Create a new manifest')} - ${l10n.t('manifest name')}`,
367+
title: `${isManifest ? l10n.t('Create a new manifest') : l10n.t('Create a new OpenAI plugin')} - ${l10n.t('output name')}`,
358368
step: step++,
359-
totalSteps: 3,
369+
totalSteps: 4,
360370
value: state.pluginName ?? '',
361-
placeholder: 'MyManifest',
362-
prompt: l10n.t('Choose a name for the manifest'),
371+
placeholder: `${isManifest ? 'MyManifest' : 'MyOpenAIPlugin'}`,
372+
prompt: `${isManifest ? l10n.t('Choose a name for the manifest') : l10n.t('Choose a name for the OpenAI plugin')}`,
363373
validate: validateIsNotEmpty,
364374
shouldResume: shouldResume
365375
});
366376
}
367377
updateWorkspaceFolder(state.pluginName);
368-
return (input: MultiStepInput) => inputManifestOutputPath(input, state);
378+
return (input: MultiStepInput) => inputOtherGenerationTypeOutputPath(input, state);
369379
}
370-
async function inputManifestOutputPath(input: MultiStepInput, state: Partial<GenerateState>) {
380+
async function inputOtherGenerationTypeOutputPath(input: MultiStepInput, state: Partial<GenerateState>) {
371381
while (true) {
382+
const isManifest = state.pluginTypes && Array.isArray(state.pluginTypes) && state.pluginTypes.includes('ApiManifest');
383+
372384
const selectedOption = await input.showQuickPick({
373-
title: `${l10n.t('Create a new manifest')} - ${l10n.t('output directory')}`,
385+
title: `${isManifest ? l10n.t('Create a new manifest') : l10n.t('Create a new OpenAI plugin')} - ${l10n.t('output directory')}`,
374386
step: step++,
375-
totalSteps: 3,
387+
totalSteps: 4,
376388
placeholder: l10n.t('Enter an output path relative to the root of the project'),
377389
items: inputOptions,
378390
shouldResume: shouldResume

vscode/microsoft-kiota/src/utilities/deep-linking.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { getSanitizedString, parseGenerationLanguage, allGenerationLanguagesToSt
44
import { createTemporaryFolder } from "./temporary-folder";
55

66
export function isDeeplinkEnabled(deepLinkParams: Partial<IntegrationParams>): boolean {
7-
return Object.keys(deepLinkParams).length > 0;
7+
const minimumNumberOfParams = 1;
8+
return Object.values(deepLinkParams).filter(property => property).length >= minimumNumberOfParams;
89
}
910

1011
export function transformToGenerationConfig(deepLinkParams: Partial<IntegrationParams>)
@@ -23,11 +24,12 @@ export function transformToGenerationConfig(deepLinkParams: Partial<IntegrationP
2324
generationConfig.pluginTypes = ["ApiPlugin"];
2425
break;
2526
case "openai":
26-
generationConfig.generationType = "plugin";
27+
generationConfig.generationType = "other";
2728
generationConfig.pluginTypes = ['OpenAI'];
2829
break;
2930
case "apimanifest":
30-
generationConfig.generationType = "apimanifest";
31+
generationConfig.generationType = "other";
32+
generationConfig.pluginTypes = ["ApiManifest"];
3133
break;
3234
}
3335
generationConfig.outputPath =

0 commit comments

Comments
 (0)