diff --git a/client/src/api/networks/network/mistralai.ts b/client/src/api/networks/network/mistralai.ts index 75883be9..bc350dd7 100644 --- a/client/src/api/networks/network/mistralai.ts +++ b/client/src/api/networks/network/mistralai.ts @@ -92,3 +92,28 @@ export async function openAiLabeledClusters(clusters: NetworkCommunities): Promi return clusters } + + +export async function mistralAgentCompletion({ query, agentId }: { query: string; agentId: string }): Promise { + const chatBody = { + messages: [ + { + role: "user", + content: query, + }, + ], + agent_id: agentId, + } + + const response = await fetch(`${MISTRAL_URL}/agents/completions`, { + method: "POST", + headers: postHeaders, + body: JSON.stringify(chatBody), + }) + const completion = await response.json() + const answer: string = completion?.choices?.[0]?.message?.content || null + + const json = answer ? JSON.parse(answer) : undefined + + return json +} \ No newline at end of file diff --git a/client/src/pages/networks/components/filters/button.tsx b/client/src/pages/networks/components/filters/button.tsx index 070bc137..112466fa 100644 --- a/client/src/pages/networks/components/filters/button.tsx +++ b/client/src/pages/networks/components/filters/button.tsx @@ -1,11 +1,15 @@ import { Badge, Button } from "@dataesr/dsfr-plus" import useScreenSize from "../../../../hooks/useScreenSize" import useUrl from "../../../search/hooks/useUrl" +import useIntegration from "../../hooks/useIntegration" export default function NetworkFiltersButton() { const { screen } = useScreenSize() + const { integrationOptions } = useIntegration() const { currentFilters } = useUrl() + if (integrationOptions.showFilters === false) return null + return ( - - - - - - - - ) -} diff --git a/client/src/pages/networks/components/options-bar/index.tsx b/client/src/pages/networks/components/options-bar/index.tsx index 2803bde7..4718155d 100644 --- a/client/src/pages/networks/components/options-bar/index.tsx +++ b/client/src/pages/networks/components/options-bar/index.tsx @@ -6,10 +6,13 @@ import NetworkSelectSourceButton from "../select-source/button" import NetworkFiltersButton from "../filters/button" import NetworkParametersButton from "../parameters/button" import useScreenSize from "../../../../hooks/useScreenSize" +import useIntegration from "../../hooks/useIntegration" export default function NetworksOptionsBar() { const { screen } = useScreenSize() - console.log("screen", screen) + const { integrationOptions } = useIntegration() + + if (integrationOptions.showOptionsBar === false) return null return ( diff --git a/client/src/pages/networks/components/parameters/button.tsx b/client/src/pages/networks/components/parameters/button.tsx index 9e73cd99..d13f2e27 100644 --- a/client/src/pages/networks/components/parameters/button.tsx +++ b/client/src/pages/networks/components/parameters/button.tsx @@ -1,11 +1,15 @@ import { Button } from "@dataesr/dsfr-plus" import useScreenSize from "../../../../hooks/useScreenSize" import { useIntl } from "react-intl" +import useIntegration from "../../hooks/useIntegration" export default function NetworkParametersButton() { const intl = useIntl() + const { integrationOptions } = useIntegration() const { screen } = useScreenSize() + if (integrationOptions.showParameters === false) return null + return ( ) } diff --git a/client/src/pages/trends/components/parameters/button.tsx b/client/src/pages/trends/components/parameters/button.tsx index f8891b4a..8f9ecb01 100644 --- a/client/src/pages/trends/components/parameters/button.tsx +++ b/client/src/pages/trends/components/parameters/button.tsx @@ -1,11 +1,15 @@ import { Button } from "@dataesr/dsfr-plus" import useScreenSize from "../../../../hooks/useScreenSize" import { useIntl } from "react-intl" +import useIntegration from "../../hooks/useIntegration" export default function TrendsParametersButton() { const intl = useIntl() + const { integrationOptions } = useIntegration() const { screen } = useScreenSize() + if (integrationOptions.showParameters === false) return null + return (