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