Skip to content

Commit

Permalink
refactor(yaml): simplify AI enabled check and improve code formatting (
Browse files Browse the repository at this point in the history
…#696)

## What type of PR is this?

/kind refactor

## What this PR does / why we need it:

This PR simplifies the AI enabled check and improves code formatting in
the YAML-related code.

Key changes include:
- Simplified the logic for checking if AI is enabled, making it more
readable and maintainable.

- Improved code formatting to adhere to consistent style guidelines,
enhancing overall code quality.

## Which issue(s) this PR fixes:

Fixes #
  • Loading branch information
elliotxx authored Dec 31, 2024
1 parent 04f6467 commit 42a67f4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
3 changes: 2 additions & 1 deletion ui/src/components/yaml/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const Yaml = (props: IProps) => {
const [isStreaming, setStreaming] = useState(false)
const abortControllerRef = useRef<AbortController | null>(null)
const { aiOptions } = useSelector((state: any) => state.globalSlice)
const isAIEnabled = aiOptions?.AIModel && aiOptions?.AIAuthToken

useEffect(() => {
const yamlStatusJson = yaml2json(data)
Expand Down Expand Up @@ -276,7 +277,7 @@ const Yaml = (props: IProps) => {
{t('Copy')}
</Button>
)}
{aiOptions?.AIAuthToken && (
{isAIEnabled && (
<Tooltip title={t('YAML.Interpret')}>
<Button
type="primary"
Expand Down
8 changes: 6 additions & 2 deletions ui/src/components/yaml/styles.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,10 @@
font-weight: 500;
}

h3, h4, h5, h6 {
h3,
h4,
h5,
h6 {
font-size: 14px !important;
margin-top: 8px;
margin-bottom: 6px;
Expand All @@ -391,7 +394,8 @@
line-height: 1.5;
}

ul, ol {
ul,
ol {
font-size: 14px !important;
margin-bottom: 6px;
padding-left: 16px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,7 @@
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(
135deg,
#722ed1 0%,
#1890ff 100%
);
background: linear-gradient(135deg, #722ed1 0%, #1890ff 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
opacity: 0.5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
left: 0;
background: #f7faff;
}

}

// Loading state styles
Expand Down

0 comments on commit 42a67f4

Please sign in to comment.