|
@@ -88,7 +88,11 @@ function TokensPage() {
|
|
|
function openFluentNotification(key) {
|
|
function openFluentNotification(key) {
|
|
|
const { t } = latestRef.current;
|
|
const { t } = latestRef.current;
|
|
|
const SUPPRESS_KEY = 'fluent_notify_suppressed';
|
|
const SUPPRESS_KEY = 'fluent_notify_suppressed';
|
|
|
- if (localStorage.getItem(SUPPRESS_KEY) === '1') return;
|
|
|
|
|
|
|
+ if (modelOptions.length === 0) {
|
|
|
|
|
+ // fire-and-forget; a later effect will refresh the notice content
|
|
|
|
|
+ loadModels()
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!key && localStorage.getItem(SUPPRESS_KEY) === '1') return;
|
|
|
const container = document.getElementById('fluent-new-api-container');
|
|
const container = document.getElementById('fluent-new-api-container');
|
|
|
if (!container) {
|
|
if (!container) {
|
|
|
Toast.warning(t('未检测到 FluentRead(流畅阅读),请确认扩展已启用'));
|
|
Toast.warning(t('未检测到 FluentRead(流畅阅读),请确认扩展已启用'));
|
|
@@ -96,19 +100,15 @@ function TokensPage() {
|
|
|
}
|
|
}
|
|
|
setPrefillKey(key || '');
|
|
setPrefillKey(key || '');
|
|
|
setFluentNoticeOpen(true);
|
|
setFluentNoticeOpen(true);
|
|
|
- if (modelOptions.length === 0) {
|
|
|
|
|
- // fire-and-forget; a later effect will refresh the notice content
|
|
|
|
|
- loadModels()
|
|
|
|
|
- }
|
|
|
|
|
Notification.info({
|
|
Notification.info({
|
|
|
id: 'fluent-detected',
|
|
id: 'fluent-detected',
|
|
|
title: t('检测到 FluentRead(流畅阅读)'),
|
|
title: t('检测到 FluentRead(流畅阅读)'),
|
|
|
content: (
|
|
content: (
|
|
|
<div>
|
|
<div>
|
|
|
<div style={{ marginBottom: 8 }}>
|
|
<div style={{ marginBottom: 8 }}>
|
|
|
- {prefillKey
|
|
|
|
|
- ? t('已检测到 FluentRead 扩展,已从操作中指定密钥,将使用该密钥进行填充。请选择模型后继续。')
|
|
|
|
|
- : t('已检测到 FluentRead 扩展,请选择模型后可一键填充当前选中令牌(或本页第一个令牌)。')}
|
|
|
|
|
|
|
+ {key
|
|
|
|
|
+ ? t('请选择模型。')
|
|
|
|
|
+ : t('选择模型后可一键填充当前选中令牌(或本页第一个令牌)。')}
|
|
|
</div>
|
|
</div>
|
|
|
<div style={{ marginBottom: 8 }}>
|
|
<div style={{ marginBottom: 8 }}>
|
|
|
<Select
|
|
<Select
|
|
@@ -126,13 +126,15 @@ function TokensPage() {
|
|
|
<Button theme="solid" type="primary" onClick={handlePrefillToFluent}>
|
|
<Button theme="solid" type="primary" onClick={handlePrefillToFluent}>
|
|
|
{t('一键填充到 FluentRead')}
|
|
{t('一键填充到 FluentRead')}
|
|
|
</Button>
|
|
</Button>
|
|
|
- <Button type="warning" onClick={() => {
|
|
|
|
|
- localStorage.setItem(SUPPRESS_KEY, '1');
|
|
|
|
|
- Notification.close('fluent-detected');
|
|
|
|
|
- Toast.info(t('已关闭后续提醒'));
|
|
|
|
|
- }}>
|
|
|
|
|
- {t('不再提醒')}
|
|
|
|
|
- </Button>
|
|
|
|
|
|
|
+ {!key && (
|
|
|
|
|
+ <Button type="warning" onClick={() => {
|
|
|
|
|
+ localStorage.setItem(SUPPRESS_KEY, '1');
|
|
|
|
|
+ Notification.close('fluent-detected');
|
|
|
|
|
+ Toast.info(t('已关闭后续提醒'));
|
|
|
|
|
+ }}>
|
|
|
|
|
+ {t('不再提醒')}
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ )}
|
|
|
<Button type="tertiary" onClick={() => Notification.close('fluent-detected')}>
|
|
<Button type="tertiary" onClick={() => Notification.close('fluent-detected')}>
|
|
|
{t('关闭')}
|
|
{t('关闭')}
|
|
|
</Button>
|
|
</Button>
|