Skip to content

Commit

Permalink
Merge pull request #2120 from AdaptiveConsulting/nlp--fix
Browse files Browse the repository at this point in the history
fix(client): NLP commands not working for workspace
  • Loading branch information
TobyLi96 authored Sep 23, 2022
2 parents 06372e4 + 2d36907 commit 02796f0
Show file tree
Hide file tree
Showing 7 changed files with 5,277 additions and 762 deletions.
30 changes: 15 additions & 15 deletions src/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"build-storybook": "build-storybook -o ./dist/storybook"
},
"dependencies": {
"@adaptive/hydra-platform": "^3.99.0",
"@adaptive/hydra-platform": "^3.120.0",
"@finos/fdc3": "^1.2.0",
"@openfin/workspace": "^6.1.6",
"@openfin/workspace-platform": "^6.1.6",
Expand Down
11 changes: 5 additions & 6 deletions src/client/src/Launcher/services/nlpService.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { Direction } from "@/services/trades"
import { DetectIntentResponse } from "dialogflow"
import { ajax, AjaxResponse } from "rxjs/ajax"
import { fromFetch } from "rxjs/fetch"
import { bind } from "@react-rxjs/core"
import { createSignal } from "@react-rxjs/utils"
import {
catchError,
distinctUntilChanged,
map,
mapTo,
pluck,
switchMap,
} from "rxjs/operators"
import { equals } from "@/utils"
Expand Down Expand Up @@ -90,13 +89,13 @@ export const [useNlpIntent, nlpIntent$] = bind<NlpIntent | null | Loading>(
? [null]
: concat(
timer(250).pipe(mapTo("loading" as Loading)),
ajax(
fromFetch(
`${import.meta.env.VITE_CLOUD_FUNCTION_HOST}/nlp?term=${request}`,
).pipe(
map<AjaxResponse, DetectIntentResponse[]>(
({ response }) => response,
switchMap((response) => response.json()),
map<DetectIntentResponse[], DetectIntentResponse>(
([response]) => response,
),
pluck(0),
catchError((e) => {
console.error("Error getting nlp response", e)
return of(null)
Expand Down
1 change: 1 addition & 0 deletions src/client/src/generated/TradingGateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,7 @@ export function checkCompatibility(): Observable<HydraPlatform.VersionNegotiatio
methodRouteKey: BigInt("-7994767111825425152"),
},
],
checkHandlersAreRegistered: true,
},
)
}
Loading

0 comments on commit 02796f0

Please sign in to comment.