Complete type defined. (#1200)

This commit is contained in:
Rhon Joe
2023-09-20 12:27:06 +08:00
committed by GitHub
parent 1367f34398
commit e65f9cb17a
4 changed files with 27 additions and 23 deletions

View File

@@ -1,9 +1,10 @@
'use client'
import React from 'react'
import { useRef, useState } from 'react'
import { t } from 'i18next'
import copy from 'copy-to-clipboard'
import s from './style.module.css'
import Tooltip from '@/app/components/base/tooltip'
import { randomString } from '@/utils'
type ICopyBtnProps = {
value: string
@@ -16,12 +17,13 @@ const CopyBtn = ({
className,
isPlain,
}: ICopyBtnProps) => {
const [isCopied, setIsCopied] = React.useState(false)
const [isCopied, setIsCopied] = useState(false)
const selector = useRef(`copy-tooltip-${randomString(4)}`)
return (
<div className={`${className}`}>
<Tooltip
selector={`copy-btn-tooltip-${value}`}
selector={selector.current}
content={(isCopied ? t('appApi.copied') : t('appApi.copy')) as string}
className='z-10'
>

View File

@@ -14,6 +14,8 @@ import OpeningStatement from '@/app/components/app/configuration/features/chat-g
import GroupName from '@/app/components/app/configuration/base/group-name'
import Loading from '@/app/components/base/loading'
import Confirm from '@/app/components/base/confirm'
// type
import type { AutomaticRes } from '@/service/debug'
const noDataIcon = (
<svg width="56" height="56" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -21,12 +23,6 @@ const noDataIcon = (
</svg>
)
export type AutomaticRes = {
prompt: string
variables: string[]
opening_statement: string
}
export type IGetAutomaticResProps = {
mode: AppType
isShow: boolean
@@ -98,7 +94,7 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
audiences,
hoping_to_solve: hopingToSolve,
})
setRes(res as AutomaticRes)
setRes(res)
}
finally {
setLoadingFalse()
@@ -193,7 +189,7 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
onClose={() => setShowConfirmOverwrite(false)}
onConfirm={() => {
setShowConfirmOverwrite(false)
onFinished(res as AutomaticRes)
onFinished(res!)
}}
onCancel={() => setShowConfirmOverwrite(false)}
/>