Skip to content

Commit

Permalink
[feature] ai, show doc link when get engines failed
Browse files Browse the repository at this point in the history
**Phenomenon and reproduction steps**

none

**Root cause and solution**

none

**Impactions**

none

**Test method**

none

**Affected branch(es)**

- main

**Checklist**

- [ ] Dependencies update required
- [ ] Common bug (similar problem in other repo)
  • Loading branch information
twou12031 committed Apr 10, 2024
1 parent cd33d35 commit c73e775
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions deepflow-apptracing-panel/src/components/AskGPT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,11 @@ export const AskGPT: React.FC<Props> = ({ data }) => {
setCheckedAiEngine(list.filter(e => !e.disabled)?.[0].value || '')
} catch (error: any) {
setErrorMsg(`GET ENGINES FAILED: ${error.message}`)

setDrawerData({
inRequest: false,
answer: `<a style="margin: 10px 0; text-decoration: underline; color: #6e9fff; display: block;" href="https://deepflow.io/docs/zh/best-practice/production-deployment/#%E4%BD%BF%E7%94%A8ai%E6%A8%A1%E5%9E%8B" target="_blank">Engine帮助文档</a>`,
answerIsEnd: true
})
setTimeout(() => {
setErrorMsg('')
}, 800)
Expand Down Expand Up @@ -365,7 +369,7 @@ export const AskGPT: React.FC<Props> = ({ data }) => {
overflow: 'auto'
}}
>
{drawerData.answer !== '' && !drawerData.inRequest ? (
{checkedAiEngine && drawerData.answer !== '' && !drawerData.inRequest ? (
<IconButton
onClick={copyAnswer}
aria-label="Copy"
Expand Down
7 changes: 6 additions & 1 deletion deepflow-topo-panel/src/components/AskGPT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ export const AskGPT: React.FC<Props> = ({ data }) => {
setCheckedAiEngine(list.filter(e => !e.disabled)?.[0].value || '')
} catch (error: any) {
setErrorMsg(`GET ENGINES FAILED: ${error.message}`)
setDrawerData({
inRequest: false,
answer: `<a style="margin: 10px 0; text-decoration: underline; color: #6e9fff; display: block;" href="https://deepflow.io/docs/zh/best-practice/production-deployment/#%E4%BD%BF%E7%94%A8ai%E6%A8%A1%E5%9E%8B" target="_blank">Engine帮助文档</a>`,
answerIsEnd: true
})
setTimeout(() => {
setErrorMsg('')
}, 800)
Expand Down Expand Up @@ -359,7 +364,7 @@ export const AskGPT: React.FC<Props> = ({ data }) => {
overflow: 'auto'
}}
>
{drawerData.answer !== '' && !drawerData.inRequest ? (
{checkedAiEngine && drawerData.answer !== '' && !drawerData.inRequest ? (
<IconButton
onClick={copyAnswer}
aria-label="Copy"
Expand Down

0 comments on commit c73e775

Please sign in to comment.