Skip to content

Commit

Permalink
feat(networks): enable clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
ahonestla committed May 31, 2024
1 parent 61f509a commit 27d9253
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
3 changes: 0 additions & 3 deletions client/src/api/networks/network/mistralai.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NetworkCommunities } from "../../../types/network"

const ENABLE_DEV = import.meta.env.DEV || import.meta.env.MODE === "staging"
const { VITE_MISTRAL_URL: MISTRAL_URL, VITE_MISTRAL_KEY: MISTRAL_KEY } = import.meta.env
const headers = MISTRAL_KEY ? { Authorization: `Bearer ${MISTRAL_KEY}` } : {}
const postHeaders = { ...headers, "Content-Type": "application/json" }
Expand Down Expand Up @@ -38,8 +37,6 @@ async function mistralLabelsFromDomains(domains: string): Promise<string> {
}

export async function openAiLabeledClusters(clusters: NetworkCommunities): Promise<NetworkCommunities> {
if (!ENABLE_DEV) return clusters

const prefix = "list"
const domains = clusters?.reduce((acc, cluster, index) => {
if (cluster?.domains) {
Expand Down
8 changes: 2 additions & 6 deletions client/src/pages/networks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ const NETWORK_TABS_MAPPING = {
},
}

const ENABLE_DEV = import.meta.env.DEV || import.meta.env.MODE === "staging"

const networkQuery = (query: string) => query || "*"
const networkTabs = Object.values(NETWORK_TABS_MAPPING).sort((a, b) => a.index - b.index)
const networkTabFindIndex = (label: string) => networkTabs.findIndex((tab) => tab.label === label)
Expand All @@ -66,14 +64,12 @@ function NetworksPage() {
const { screen } = useScreenSize()
const { currentQuery, handleQueryChange } = useUrl()
const { currentTab, handleTabChange } = useTab()
const { clusters: computeClusters, handleClustersChange, disableClusters } = useClusters()
const { clusters: computeClusters, handleClustersChange } = useClusters()
const [focusItem, setFocusItem] = useState("")
const resetFocus = () => setFocusItem("")

const isMobile = screen === "sm" || screen === "xs"

if (!ENABLE_DEV) disableClusters()

return (
<>
<Container className={"bg-network"} fluid>
Expand Down Expand Up @@ -139,7 +135,7 @@ function NetworksPage() {
handleClustersChange(value)
resetFocus()
}}
show={ENABLE_DEV}
show={true}
/>
<p className="fr-text--xs fr-text-mention--grey">
{intl.formatMessage({ id: "networks.clusters.button.description" })}
Expand Down

0 comments on commit 27d9253

Please sign in to comment.