Clarify Picture Agent template refresh state
This commit is contained in:
@@ -432,7 +432,7 @@ export default function PictureAgent() {
|
||||
setModel((current) => current || 'gpt-image-2');
|
||||
setTemplates(FALLBACK_TEMPLATES);
|
||||
setTemplatesError('');
|
||||
setTemplatesLoading(true);
|
||||
setTemplatesLoading(false);
|
||||
try {
|
||||
const [statusResult, modelsResult, jobsResult] = await Promise.allSettled([
|
||||
authedFetch('/api/picture-agent/status', { timeoutMs: 8_000 }),
|
||||
@@ -484,6 +484,7 @@ export default function PictureAgent() {
|
||||
}
|
||||
|
||||
try {
|
||||
if (!ignore) setTemplatesLoading(true);
|
||||
const templatesRes = await authedFetch(`/api/picture-agent/templates?limit=${TEMPLATE_LIMIT}`, { timeoutMs: 10_000 });
|
||||
if (ignore) return;
|
||||
if (!templatesRes.ok) {
|
||||
@@ -923,7 +924,15 @@ export default function PictureAgent() {
|
||||
<div className="picture-agent-template-strip">
|
||||
<div className="picture-agent-template-title">
|
||||
<strong>参考模板</strong>
|
||||
<span>{templatesLoading ? '正在刷新模板...' : '内置模板优先,外部图库可用时自动补充'}</span>
|
||||
<span>
|
||||
{templatesLoading && templates.length === 0
|
||||
? '正在加载参考模板...'
|
||||
: templatesLoading
|
||||
? '本地模板可用,正在后台补充图库'
|
||||
: templatesError
|
||||
? '远程图库暂不可用,已使用本地模板'
|
||||
: '来自 Linux Do GPT Image Gallery'}
|
||||
</span>
|
||||
</div>
|
||||
<div className="picture-agent-template-list">
|
||||
{templatesError && templates.length === 0 ? (
|
||||
|
||||
Reference in New Issue
Block a user