Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ui/src/pages/result/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { ICON_MAP } from '@/utils/images'
import { searchSqlPrefix, tabsList } from '@/utils/constants'
import { useAxios } from '@/utils/request'
import { PodStatusCell } from '@/pages/insightDetail/components/sourceTable'
import { useSelector } from 'react-redux'
// import useDebounce from '@/hooks/useDebounce'

import styles from './styles.module.less'
Expand Down Expand Up @@ -412,11 +413,19 @@ const Result = () => {
label: renderOption(val),
}))

const { aiOptions } = useSelector((state: any) => state.globalSlice)
const isAIEnabled = aiOptions?.AIModel && aiOptions?.AIAuthToken

const updatedTabsList = tabsList.map(tab => ({
...tab,
disabled: tab.value === 'natural' ? !isAIEnabled : tab.disabled,
}))

return (
<div className={styles.container}>
<div className={styles.searchTab}>
<KarporTabs
list={tabsList}
list={updatedTabsList}
current={searchType}
onChange={handleTabChange}
/>
Expand Down
11 changes: 10 additions & 1 deletion ui/src/pages/search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import logoFull from '@/assets/img/logo-full.svg'
import SqlSearch from '@/components/sqlSearch'
import { defaultSqlExamples, tabsList } from '@/utils/constants'
import { deleteHistoryByItem, getHistoryList } from '@/utils/tools'
import { useSelector } from 'react-redux'

const { Search } = Input

Expand Down Expand Up @@ -124,6 +125,14 @@ const SearchPage = () => {
label: renderOption(val),
}))

const { aiOptions } = useSelector((state: any) => state.globalSlice)
const isAIEnabled = aiOptions?.AIModel && aiOptions?.AIAuthToken

const updatedTabsList = tabsList.map(tab => ({
...tab,
disabled: tab.value === 'natural' ? !isAIEnabled : tab.disabled,
}))

return (
<div className={styles.search_container}>
<div className={styles.search}>
Expand All @@ -132,7 +141,7 @@ const SearchPage = () => {
</div>
<div className={styles.searchTab}>
<KarporTabs
list={tabsList}
list={updatedTabsList}
current={searchType}
onChange={handleTabChange}
/>
Expand Down
Loading