feat: add AI insight notification toggle

This commit is contained in:
Jason
2026-05-05 12:08:32 +08:00
parent becec65ee3
commit b4758d690b
6 changed files with 87 additions and 27 deletions

View File

@@ -199,6 +199,7 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
const [transcribeLanguages, setTranscribeLanguages] = useState<string[]>(['zh'])
const [notificationEnabled, setNotificationEnabled] = useState(true)
const [aiInsightNotificationEnabled, setAiInsightNotificationEnabled] = useState(true)
const [notificationPosition, setNotificationPosition] = useState<'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center'>('top-right')
const [notificationFilterMode, setNotificationFilterMode] = useState<'all' | 'whitelist' | 'blacklist'>('all')
const [notificationFilterList, setNotificationFilterList] = useState<string[]>([])
@@ -458,6 +459,7 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
const savedAutoTranscribe = await configService.getAutoTranscribeVoice()
const savedTranscribeLanguages = await configService.getTranscribeLanguages()
const savedNotificationEnabled = await configService.getNotificationEnabled()
const savedAiInsightNotificationEnabled = await configService.getAiInsightNotificationEnabled()
const savedNotificationPosition = await configService.getNotificationPosition()
const savedNotificationFilterMode = await configService.getNotificationFilterMode()
const savedNotificationFilterList = await configService.getNotificationFilterList()
@@ -512,6 +514,7 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
setTranscribeLanguages(savedTranscribeLanguages)
setNotificationEnabled(savedNotificationEnabled)
setAiInsightNotificationEnabled(savedAiInsightNotificationEnabled)
setNotificationPosition(savedNotificationPosition)
setNotificationFilterMode(savedNotificationFilterMode)
setNotificationFilterList(savedNotificationFilterList)
@@ -1903,6 +1906,29 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
</div>
</div>
<div className="form-group">
<label>AI </label>
<span className="form-hint"> AI Telegram </span>
<div className="log-toggle-line">
<span className="log-status">{aiInsightNotificationEnabled ? '已开启' : '已关闭'}</span>
<label className="switch" htmlFor="ai-insight-notification-enabled-toggle">
<input
id="ai-insight-notification-enabled-toggle"
className="switch-input"
type="checkbox"
checked={aiInsightNotificationEnabled}
onChange={async (e) => {
const val = e.target.checked
setAiInsightNotificationEnabled(val)
await configService.setAiInsightNotificationEnabled(val)
showMessage(val ? '已开启 AI 见解消息通知' : '已关闭 AI 见解消息通知', true)
}}
/>
<span className="switch-slider" />
</label>
</div>
</div>
<div className="form-group">
<label></label>
<span className="form-hint"></span>
@@ -3209,7 +3235,7 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
<div className="form-group">
<label>AI </label>
<span className="form-hint">
AI
AI
</span>
<div className="log-toggle-line">
<span className="log-status">{aiInsightEnabled ? '已开启' : '已关闭'}</span>