mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
feat: AI更新总结
This commit is contained in:
@@ -4,6 +4,8 @@ import { Chip } from '@heroui/chip'
|
|||||||
import { Spinner } from '@heroui/spinner'
|
import { Spinner } from '@heroui/spinner'
|
||||||
import { Tooltip } from '@heroui/tooltip'
|
import { Tooltip } from '@heroui/tooltip'
|
||||||
import { useRequest } from 'ahooks'
|
import { useRequest } from 'ahooks'
|
||||||
|
import { useEffect } from 'react'
|
||||||
|
import { BsStars } from 'react-icons/bs'
|
||||||
import { FaCircleInfo, FaInfo, FaQq } from 'react-icons/fa6'
|
import { FaCircleInfo, FaInfo, FaQq } from 'react-icons/fa6'
|
||||||
import { IoLogoChrome, IoLogoOctocat } from 'react-icons/io'
|
import { IoLogoChrome, IoLogoOctocat } from 'react-icons/io'
|
||||||
import { RiMacFill } from 'react-icons/ri'
|
import { RiMacFill } from 'react-icons/ri'
|
||||||
@@ -97,6 +99,42 @@ const NewVersionTip = (props: NewVersionTipProps) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const AISummaryComponent = () => {
|
||||||
|
const {
|
||||||
|
data: aiSummaryData,
|
||||||
|
loading: aiSummaryLoading,
|
||||||
|
error: aiSummaryError,
|
||||||
|
run: runAiSummary
|
||||||
|
} = useRequest(
|
||||||
|
(version) =>
|
||||||
|
request.get<ServerResponse<string | null>>(
|
||||||
|
`https://release.nc.152710.xyz/?version=${version}`,
|
||||||
|
{
|
||||||
|
timeout: 30000
|
||||||
|
}
|
||||||
|
),
|
||||||
|
{
|
||||||
|
manual: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
runAiSummary(currentVersion)
|
||||||
|
}, [currentVersion, runAiSummary])
|
||||||
|
|
||||||
|
if (aiSummaryLoading) {
|
||||||
|
return (
|
||||||
|
<div className="flex justify-center py-1">
|
||||||
|
<Spinner size="sm" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (aiSummaryError) {
|
||||||
|
return <div className="text-center text-danger-500">AI 摘要获取失败</div>
|
||||||
|
}
|
||||||
|
return <span className="text-default-700">{aiSummaryData?.data.data}</span>
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip content="有新版本可用">
|
<Tooltip content="有新版本可用">
|
||||||
<Button
|
<Button
|
||||||
@@ -120,6 +158,13 @@ const NewVersionTip = (props: NewVersionTipProps) => {
|
|||||||
<span>最新版本</span>
|
<span>最新版本</span>
|
||||||
<Chip color="primary">{latestVersion}</Chip>
|
<Chip color="primary">{latestVersion}</Chip>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="p-2 rounded-md bg-content2 text-sm">
|
||||||
|
<div className="text-danger-400 font-bold flex items-center gap-1 mb-1">
|
||||||
|
<BsStars />
|
||||||
|
<span>AI总结</span>
|
||||||
|
</div>
|
||||||
|
{<AISummaryComponent />}
|
||||||
|
</div>
|
||||||
<div className="text-sm space-y-2 !mt-4">
|
<div className="text-sm space-y-2 !mt-4">
|
||||||
{middleVersions.map((versionInfo) => (
|
{middleVersions.map((versionInfo) => (
|
||||||
<div
|
<div
|
||||||
|
Reference in New Issue
Block a user