@gravitee/ui-policy-studio-angular 16.1.0-apim-11657-adapt-ui-for-llm-a5b7b44 → 16.1.0-apim-11657-adapt-ui-for-llm-02958f3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -154,7 +154,7 @@ function fakeMcpFlow(modifier) {
154
154
  }
155
155
  function fakeLlmFlow(modifier) {
156
156
  const httpSelector = {
157
- type: 'LLM',
157
+ type: 'HTTP',
158
158
  path: '/path',
159
159
  pathOperator: 'EQUALS',
160
160
  methods: ['GET'],
@@ -1899,9 +1899,9 @@ class GioPolicyStudioHarness extends ComponentHarness {
1899
1899
  * @param groupName Plan name where to add the flow. You also can define "Common flows" to add a flow to this group.
1900
1900
  * @param flow Flow to add
1901
1901
  */
1902
- async addFlow(groupName, flow) {
1902
+ async addFlow(groupName, flow, apiType) {
1903
1903
  await (await this.menuHarness()).addFlow(new RegExp(groupName, 'i'));
1904
- await this.setFlowFormDialog(flow);
1904
+ await this.setFlowFormDialog(flow, apiType);
1905
1905
  }
1906
1906
  /**
1907
1907
  * Edit a flow configuration
@@ -1909,10 +1909,10 @@ class GioPolicyStudioHarness extends ComponentHarness {
1909
1909
  * @param flowName Flow name to edit
1910
1910
  * @param flow
1911
1911
  */
1912
- async editFlowConfig(flowName, flow) {
1912
+ async editFlowConfig(flowName, flow, apiType) {
1913
1913
  (await this.menuHarness()).selectFlow(new RegExp(flowName, 'i'));
1914
1914
  await (await this.detailsHarness()).clickEditFlowBtn();
1915
- await this.setFlowFormDialog(flow);
1915
+ await this.setFlowFormDialog(flow, apiType);
1916
1916
  }
1917
1917
  /**
1918
1918
  * Delete a flow
@@ -1991,12 +1991,12 @@ class GioPolicyStudioHarness extends ComponentHarness {
1991
1991
  async save() {
1992
1992
  await (await this.locatorFor(MatButtonHarness.with({ text: /Save/ }))()).click();
1993
1993
  }
1994
- async setFlowFormDialog(flow) {
1994
+ async setFlowFormDialog(flow, apiType) {
1995
1995
  const channelSelector = flow.selectors?.find(s => s.type === 'CHANNEL');
1996
1996
  const httpSelector = flow.selectors?.find(s => s.type === 'HTTP');
1997
1997
  const conditionSelector = flow.selectors?.find(s => s.type === 'CONDITION');
1998
1998
  const mcpSelector = flow.selectors?.find(s => s.type === 'MCP');
1999
- const llmSelector = flow.selectors?.find(s => s.type === 'LLM');
1999
+ const isLlm = apiType === 'LLM';
2000
2000
  if (!!channelSelector && !!httpSelector) {
2001
2001
  throw new Error('Channel and HTTP selectors are not be used together.');
2002
2002
  }
@@ -2017,7 +2017,7 @@ class GioPolicyStudioHarness extends ComponentHarness {
2017
2017
  await flowFormNewDialog.save();
2018
2018
  return;
2019
2019
  }
2020
- if (httpSelector) {
2020
+ if (httpSelector && !isLlm) {
2021
2021
  const flowFormNewDialog = await this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowProxyFormDialogHarness)();
2022
2022
  await flowFormNewDialog.setFlowFormValues({
2023
2023
  name: flow.name,
@@ -2029,23 +2029,23 @@ class GioPolicyStudioHarness extends ComponentHarness {
2029
2029
  await flowFormNewDialog.save();
2030
2030
  return;
2031
2031
  }
2032
- if (mcpSelector) {
2033
- const flowFormNewDialog = await this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowMcpFormDialogHarness)();
2032
+ if (isLlm) {
2033
+ const flowFormNewDialog = await this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowLlmFormDialogHarness)();
2034
2034
  await flowFormNewDialog.setFlowFormValues({
2035
2035
  name: flow.name,
2036
- methods: mcpSelector?.methods,
2036
+ path: httpSelector?.path,
2037
+ pathOperator: httpSelector?.pathOperator,
2038
+ methods: httpSelector?.methods,
2037
2039
  condition: conditionSelector?.condition,
2038
2040
  });
2039
2041
  await flowFormNewDialog.save();
2040
2042
  return;
2041
2043
  }
2042
- if (llmSelector) {
2043
- const flowFormNewDialog = await this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowLlmFormDialogHarness)();
2044
+ if (mcpSelector) {
2045
+ const flowFormNewDialog = await this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowMcpFormDialogHarness)();
2044
2046
  await flowFormNewDialog.setFlowFormValues({
2045
2047
  name: flow.name,
2046
- path: llmSelector?.path,
2047
- pathOperator: llmSelector?.pathOperator,
2048
- methods: llmSelector?.methods,
2048
+ methods: mcpSelector?.methods,
2049
2049
  condition: conditionSelector?.condition,
2050
2050
  });
2051
2051
  await flowFormNewDialog.save();