Skip to content

Commit 6cbc616

Browse files
Eric-B-Wutakyyonccastrotrejo
authored
fix(designer): Cherry Picks (#7158)
* fix(designer): Remove Pin on Deleting Node (#7140) add fix * fix(designer): Refactor and remove unsupported types from Agent parameter creation (#7142) update agent parameter type * feat(designer): Search Enhancements (#7147) * search updates * small fix * changes * adding changes * fix test * fix e2e test * fix(designer): Remove default, rename tab and update channel (#7136) * remove * update parameters to details * channel option updated * update 1 * feat(designer): Add header actions buttons for agent chat (#7128) * Add buttons to refresh and stop conversation * Update icons * Add function to refetch all of the queries related to runs * Update refresh * Add cancel workflow * Add cancel workflow * Implement dialog for stop chat * Add intl text * Update dialog * Update snapshots * Fix tests * Update with custom backdrop * Update refresh properly * Update async mutation * Add cancel run for consumption * fix(designer): Update agent initial template and add connection label (#7120) * Update new fresh agent workflow definition * Update inline connection * Update logic to show text * Update logic * cherry pick * fix(designer): Dropdown items for deployment names (#7154) * add dropdown deployments * update 1 * remove agent deployment * fix(designer): Set properties per Model and add a subscription filter (#7157) * set deployment properties * filter * add subscription --------- Co-authored-by: Krrish Mittal <11722204+takyyon@users.noreply.github.com> Co-authored-by: Carlos Emiliano Castro Trejo <102700317+ccastrotrejo@users.noreply.github.com>
1 parent af9d1c0 commit 6cbc616

File tree

69 files changed

+2115
-623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2115
-623
lines changed

Localize/lang/strings.json

+56-10
Large diffs are not rendered by default.

apps/Standalone/src/designer/app/AzureLogicAppsDesigner/Models/Workflow.ts

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export interface AgentConnectionModel {
9696
endpoint: string;
9797
type?: string;
9898
displayName?: string;
99+
resourceId: string;
99100
}
100101

101102
export interface ConnectionAndAppSetting {

apps/Standalone/src/designer/app/AzureLogicAppsDesigner/Services/WorkflowAndArtifacts.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { CallbackInfo, ConnectionsData, ParametersData, Workflow } from '..
33
import { Artifact } from '../Models/Workflow';
44
import { validateResourceId } from '../Utilities/resourceUtilities';
55
import { convertDesignerWorkflowToConsumptionWorkflow } from './ConsumptionSerializationHelpers';
6-
import { getReactQueryClient, type AllCustomCodeFiles } from '@microsoft/logic-apps-designer';
6+
import { getReactQueryClient, runsQueriesKeys, type AllCustomCodeFiles } from '@microsoft/logic-apps-designer';
77
import { CustomCodeService, LogEntryLevel, LoggerService, equals, getAppFileForFileExtension } from '@microsoft/logic-apps-shared';
88
import type { LogicAppsV2, VFSObject } from '@microsoft/logic-apps-shared';
99
import axios from 'axios';
@@ -181,7 +181,7 @@ export const getWorkflowAndArtifactsConsumption = async (workflowId: string): Pr
181181

182182
export const useRunInstanceStandard = (workflowName: string, appId?: string, runId?: string) => {
183183
return useQuery(
184-
['getRunInstance', appId, workflowName, runId],
184+
[runsQueriesKeys.useRunInstance, appId, workflowName, runId],
185185
async () => {
186186
if (!appId) {
187187
return;
@@ -217,7 +217,7 @@ export const useRunInstanceStandard = (workflowName: string, appId?: string, run
217217

218218
export const useRunInstanceConsumption = (workflowname: string, appId?: string, runId?: string) => {
219219
return useQuery(
220-
['getRunInstance', workflowname, runId],
220+
[runsQueriesKeys.useRunInstance, workflowname, runId],
221221
async () => {
222222
const results = await axios.get<LogicAppsV2.RunInstanceDefinition>(
223223
`${baseUrl}${appId}/runs/${runId}?api-version=${consumptionApiVersion}&$expand=properties/actions,workflow/properties`,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type {
2+
IConnectionParameterEditorOptions,
3+
IConnectionParameterEditorService,
4+
IConnectionParameterInfo,
5+
} from '@microsoft/logic-apps-shared';
6+
import { CustomOpenAIConnector } from '@microsoft/logic-apps-designer';
7+
8+
export class CustomConnectionParameterEditorService implements IConnectionParameterEditorService {
9+
public getConnectionParameterEditor({ connectorId }: IConnectionParameterInfo): IConnectionParameterEditorOptions | undefined {
10+
if (connectorId === 'connectionProviders/agent') {
11+
return {
12+
EditorComponent: CustomOpenAIConnector,
13+
};
14+
}
15+
16+
return undefined;
17+
}
18+
}

apps/Standalone/src/designer/app/AzureLogicAppsDesigner/laDesigner.tsx

+48-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import {
4747
guid,
4848
isArmResourceId,
4949
optional,
50+
BaseCognitiveServiceService,
5051
} from '@microsoft/logic-apps-shared';
5152
import type { ContentType, IHostService, IWorkflowService } from '@microsoft/logic-apps-shared';
5253
import type { AllCustomCodeFiles, CustomCodeFileNameMapping, Workflow } from '@microsoft/logic-apps-designer';
@@ -70,6 +71,7 @@ import type { QueryClient } from '@tanstack/react-query';
7071
import { useDispatch, useSelector } from 'react-redux';
7172
import { useHostingPlan } from '../../state/workflowLoadingSelectors';
7273
import CodeViewEditor from './CodeView';
74+
import { CustomConnectionParameterEditorService } from './Services/customConnectionParameterEditorService';
7375

7476
const apiVersion = '2020-06-01';
7577
const httpClient = new HttpClient();
@@ -249,7 +251,24 @@ const DesignerEditor = () => {
249251
Default_Agent: {
250252
type: 'Agent',
251253
limit: {},
252-
inputs: {},
254+
inputs: {
255+
parameters: {
256+
deploymentId: '',
257+
messages: '',
258+
agentModelType: 'AzureOpenAI',
259+
agentModelSettings: {
260+
agentHistoryReductionSettings: {
261+
agentHistoryReductionType: 'maximumTokenCountReduction',
262+
maximumTokenCount: 128000,
263+
},
264+
},
265+
},
266+
modelConfigurations: {
267+
model1: {
268+
referenceName: '',
269+
},
270+
},
271+
},
253272
tools: {},
254273
runAfter: {},
255274
},
@@ -264,7 +283,24 @@ const DesignerEditor = () => {
264283
Default_Agent: {
265284
type: 'Agent',
266285
limit: {},
267-
inputs: {},
286+
inputs: {
287+
parameters: {
288+
deploymentId: '',
289+
messages: '',
290+
agentModelType: 'AzureOpenAI',
291+
agentModelSettings: {
292+
agentHistoryReductionSettings: {
293+
agentHistoryReductionType: 'maximumTokenCountReduction',
294+
maximumTokenCount: 128000,
295+
},
296+
},
297+
},
298+
modelConfigurations: {
299+
model1: {
300+
referenceName: '',
301+
},
302+
},
303+
},
268304
tools: {},
269305
runAfter: {},
270306
},
@@ -887,6 +923,14 @@ const getDesignerServices = (
887923
httpClient,
888924
});
889925

926+
const cognitiveServiceService = new BaseCognitiveServiceService({
927+
apiVersion: '2023-10-01-preview',
928+
baseUrl: armUrl,
929+
httpClient,
930+
});
931+
932+
const connectionParameterEditorService = new CustomConnectionParameterEditorService();
933+
890934
return {
891935
appService,
892936
connectionService,
@@ -904,6 +948,8 @@ const getDesignerServices = (
904948
hostService,
905949
chatbotService,
906950
customCodeService,
951+
cognitiveServiceService,
952+
connectionParameterEditorService,
907953
userPreferenceService: new BaseUserPreferenceService(),
908954
experimentationService: new BaseExperimentationService(),
909955
};

apps/Standalone/src/designer/app/AzureLogicAppsDesigner/laDesignerConsumption.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
startsWith,
3535
StandardCustomCodeService,
3636
BaseUserPreferenceService,
37+
BaseCognitiveServiceService,
3738
} from '@microsoft/logic-apps-shared';
3839
import type { ConnectionReferences, CustomCodeFileNameMapping, Workflow, WorkflowParameter } from '@microsoft/logic-apps-designer';
3940
import {
@@ -341,6 +342,7 @@ const DesignerEditorConsumption = () => {
341342
}}
342343
switchViews={handleSwitchView}
343344
saveWorkflowFromCode={saveWorkflowFromCode}
345+
setWorkflow={setWorkflow}
344346
/>
345347
{designerView ? <Designer /> : <CodeViewEditor ref={codeEditorRef} isConsumption />}
346348
<CombineInitializeVariableDialog />
@@ -548,6 +550,12 @@ const getDesignerServices = (
548550
httpClient,
549551
});
550552

553+
const cognitiveServiceService = new BaseCognitiveServiceService({
554+
apiVersion: '2023-10-01-preview',
555+
baseUrl,
556+
httpClient,
557+
});
558+
551559
const chatbotService = new BaseChatbotService({
552560
// temporarily having brazilus as the baseUrl until deployment finishes in prod
553561
baseUrl: 'https://brazilus.management.azure.com',
@@ -591,6 +599,7 @@ const getDesignerServices = (
591599
hostService,
592600
chatbotService,
593601
customCodeService,
602+
cognitiveServiceService,
594603
userPreferenceService: new BaseUserPreferenceService(),
595604
};
596605
};

apps/Standalone/src/designer/app/LocalDesigner/customConnection/customConnectionParameterEditorService.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import type {
44
IConnectionParameterInfo,
55
} from '@microsoft/logic-apps-shared';
66
import { TargetPicker } from './TargetPicker';
7+
import { CustomOpenAIConnector } from '@microsoft/logic-apps-designer';
78

89
export class CustomConnectionParameterEditorService implements IConnectionParameterEditorService {
9-
public areCustomEditorsEnabled = false;
10+
public areCustomEditorsEnabled = true;
1011

1112
public getConnectionParameterEditor({
1213
connectorId,
@@ -22,6 +23,12 @@ export class CustomConnectionParameterEditorService implements IConnectionParame
2223
};
2324
}
2425

26+
if (connectorId === 'connectionProviders/agent') {
27+
return {
28+
EditorComponent: CustomOpenAIConnector,
29+
};
30+
}
31+
2532
return undefined;
2633
}
2734
}

apps/Standalone/src/designer/app/LocalDesigner/localDesigner.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
StandardCustomCodeService,
1919
ResourceIdentityType,
2020
BaseTenantService,
21+
BaseCognitiveServiceService,
2122
} from '@microsoft/logic-apps-shared';
2223
import type { ContentType } from '@microsoft/logic-apps-shared';
2324
import {
@@ -146,6 +147,12 @@ const runService = new StandardRunService({
146147
isDev: true,
147148
});
148149

150+
const cognitiveServiceService = new BaseCognitiveServiceService({
151+
apiVersion: '2023-10-01-preview',
152+
baseUrl: '/url',
153+
httpClient,
154+
});
155+
149156
const customCodeService = new StandardCustomCodeService({
150157
apiVersion: '2018-11-01',
151158
baseUrl: '/url',
@@ -206,6 +213,7 @@ export const LocalDesigner = () => {
206213
connectionParameterEditorService,
207214
customCodeService,
208215
uiInteractionsService,
216+
cognitiveServiceService,
209217
},
210218
readOnly: isReadOnly,
211219
isMonitoringView,

apps/vs-code-designer/src/app/utils/codeless/templates.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,24 @@ export const getCodelessWorkflowTemplate = (workflowType: WorkflowType) => {
130130
actions: {
131131
Default_Agent: {
132132
type: 'Agent',
133-
inputs: {},
133+
inputs: {
134+
parameters: {
135+
deploymentId: '',
136+
messages: '',
137+
agentModelType: 'AzureOpenAI',
138+
agentModelSettings: {
139+
agentHistoryReductionSettings: {
140+
agentHistoryReductionType: 'maximumTokenCountReduction',
141+
maximumTokenCount: 128000,
142+
},
143+
},
144+
},
145+
modelConfigurations: {
146+
model1: {
147+
referenceName: '',
148+
},
149+
},
150+
},
134151
limit: {},
135152
tools: {},
136153
runAfter: {},

apps/vs-code-react/src/app/designer/app.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export const DesignerApp = () => {
139139
isLoading,
140140
isRefetching,
141141
data: runData,
142-
} = useQuery<any>(['runInstance', { runId }], getRunInstance, {
142+
} = useQuery<any>([runsQueriesKeys.useRunInstance, { runId }], getRunInstance, {
143143
refetchOnWindowFocus: false,
144144
refetchOnMount: true,
145145
initialData: null,

apps/vs-code-react/src/app/designer/servicesHelper.ts

+8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
clone,
1717
isEmptyString,
1818
BaseTenantService,
19+
BaseCognitiveServiceService,
1920
} from '@microsoft/logic-apps-shared';
2021
import type {
2122
ApiHubServiceDetails,
@@ -325,6 +326,12 @@ export const getDesignerServices = (
325326
httpClient,
326327
});
327328

329+
const cognitiveServiceService = new BaseCognitiveServiceService({
330+
apiVersion: '2023-10-01-preview',
331+
baseUrl: armUrl,
332+
httpClient,
333+
});
334+
328335
const editorService = new CustomEditorService({
329336
areCustomEditorsEnabled: true,
330337
openRelativeLink: (relativeLink: string) => {
@@ -353,6 +360,7 @@ export const getDesignerServices = (
353360
editorService,
354361
apimService,
355362
loggerService,
363+
cognitiveServiceService,
356364
functionService,
357365
};
358366
};

e2e/designer/editors/dictionary.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test.describe(
1313
await GoToMockWorkflow(page, 'Panel');
1414
await page.getByLabel('Insert a new step between Initialize ArrayVariable and Parse JSON').click();
1515
await page.getByText('Add an action').click();
16-
await page.getByLabel('HTTP', { exact: true }).click();
16+
await page.getByLabel('HTTP', { exact: true }).first().click();
1717
await page.getByLabel('HTTP', { exact: true }).click();
1818
await page.getByTestId('msla-setting-token-editor-dictionaryeditor-headers-key-0').click();
1919
await page.keyboard.type('testkey');

e2e/designer/variables/multiVariable.spec.ts

+3
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,13 @@ test.describe(
7676
await expect(page.getByLabel('Initialize variables', { exact: true })).toContainText('Initialize variables');
7777
await page.getByLabel('Initialize variables 4', { exact: true }).click();
7878
await page.getByRole('tab', { name: 'Code view' }).click();
79+
await page.waitForFunction(() => !document.querySelector('#code-view')?.textContent?.includes('Loading'), { timeout: 1000 });
7980
await expect(page.getByRole('code')).toContainText(
8081
'{ "type": "InitializeVariable", "inputs": { "variables": [ { "name": "testBoolean2", "type": "boolean", "value": false } ] }, "runAfter": { "Initialize_variables_3": [ "SUCCEEDED" ] }}'
8182
);
8283
await page.getByTestId('card-initialize_variables_1').getByRole('button', { name: 'Initialize variables' }).click();
8384
await page.getByRole('tab', { name: 'Code view' }).click();
85+
await page.waitForFunction(() => !document.querySelector('#code-view')?.textContent?.includes('Loading'), { timeout: 1000 });
8486
await expect(page.getByRole('code')).toContainText(
8587
'{ "type": "InitializeVariable", "inputs": { "variables": [ { "name": "testVariable2", "type": "float", "value": 123.5 } ] }, "runAfter": { "Initialize_variables": [ "SUCCEEDED" ] }}'
8688
);
@@ -132,6 +134,7 @@ test.describe(
132134
await page.getByLabel('Zoom view to fit').click();
133135
await page.getByTestId('card-initialize_variables_2').getByRole('button', { name: 'Initialize variables' }).click();
134136
await page.getByRole('tab', { name: 'Code view' }).click();
137+
await page.waitForFunction(() => !document.querySelector('#code-view')?.textContent?.includes('Loading'), { timeout: 1000 });
135138
await expect(page.getByRole('code')).toContainText(
136139
'{ "type": "InitializeVariable", "inputs": { "variables": [ { "name": "testVariable1", "type": "string", "value": "123" }, { "name": "testVariable2", "type": "float", "value": 123.5 }, { "name": "testVariable3", "type": "array", "value": [] } ] }, "runAfter": {}}'
137140
);

libs/designer-ui/src/lib/constants.ts

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export const VARIABLE_TYPE = {
4646
INTEGER: 'integer',
4747
OBJECT: 'object',
4848
STRING: 'string',
49+
NUMBER: 'number',
4950
};
5051

5152
const PANEL_TAB_NAMES = {

libs/designer-ui/src/lib/dropdown/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface SerializationOptions {
1313
separator?: string;
1414
}
1515

16-
interface DropdownEditorProps {
16+
export interface DropdownEditorProps {
1717
initialValue: ValueSegment[];
1818
options: DropdownItem[];
1919
// Appearance

0 commit comments

Comments
 (0)