Spaces:
Running
Running
Deploy 8547706 to Docker Space
Browse filesSource: MisonL/gpt-image-playground-customer@8547706e57d9600ae8a8bfe7043cdbb623c342aa
- scripts/agent-doctor.mjs +11 -0
- scripts/command-center.test.mjs +22 -0
- scripts/first-run.mjs +13 -1
scripts/agent-doctor.mjs
CHANGED
|
@@ -351,6 +351,8 @@ function buildSummary({ capabilities, runtime, contract, smoke }) {
|
|
| 351 |
? Boolean(process.env.GPT_IMAGE_APP_PASSWORD_HASH)
|
| 352 |
: capabilities.ok,
|
| 353 |
page_sse_real_smoke: summarizeSmokeCheck(smoke, PAGE_SSE_GENERATE_SMOKE_NAME),
|
|
|
|
|
|
|
| 354 |
responses_gpt2image_ready:
|
| 355 |
capabilities.ok && runtime.ok
|
| 356 |
? capabilities.body?.supported?.image_backend_requirements?.['responses-image-generation']?.enabled === true &&
|
|
@@ -369,6 +371,15 @@ function summarizeSmokeCheck(smoke, name) {
|
|
| 369 |
return check.ok ? 'passed' : 'failed';
|
| 370 |
}
|
| 371 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 372 |
function authHeaders() {
|
| 373 |
if (process.env.GPT_IMAGE_AGENT_TOKEN) return { Authorization: `Bearer ${process.env.GPT_IMAGE_AGENT_TOKEN}` };
|
| 374 |
if (process.env.GPT_IMAGE_APP_PASSWORD_HASH) return { 'X-App-Password-Hash': process.env.GPT_IMAGE_APP_PASSWORD_HASH };
|
|
|
|
| 351 |
? Boolean(process.env.GPT_IMAGE_APP_PASSWORD_HASH)
|
| 352 |
: capabilities.ok,
|
| 353 |
page_sse_real_smoke: summarizeSmokeCheck(smoke, PAGE_SSE_GENERATE_SMOKE_NAME),
|
| 354 |
+
responses_page_sse_generate_smoke: summarizeSmokeCheck(smoke, PAGE_SSE_GENERATE_SMOKE_NAME),
|
| 355 |
+
real_smoke_checks: summarizeSmokeChecks(smoke),
|
| 356 |
responses_gpt2image_ready:
|
| 357 |
capabilities.ok && runtime.ok
|
| 358 |
? capabilities.body?.supported?.image_backend_requirements?.['responses-image-generation']?.enabled === true &&
|
|
|
|
| 371 |
return check.ok ? 'passed' : 'failed';
|
| 372 |
}
|
| 373 |
|
| 374 |
+
function summarizeSmokeChecks(smoke) {
|
| 375 |
+
return {
|
| 376 |
+
agent_generate_1k: summarizeSmokeCheck(smoke, 'generate_1k'),
|
| 377 |
+
responses_page_sse_generate_1k: summarizeSmokeCheck(smoke, PAGE_SSE_GENERATE_SMOKE_NAME),
|
| 378 |
+
agent_edit_1k: summarizeSmokeCheck(smoke, 'edit_1k'),
|
| 379 |
+
page_sse_edit_2k: summarizeSmokeCheck(smoke, 'page_sse_edit_2k')
|
| 380 |
+
};
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
function authHeaders() {
|
| 384 |
if (process.env.GPT_IMAGE_AGENT_TOKEN) return { Authorization: `Bearer ${process.env.GPT_IMAGE_AGENT_TOKEN}` };
|
| 385 |
if (process.env.GPT_IMAGE_APP_PASSWORD_HASH) return { 'X-App-Password-Hash': process.env.GPT_IMAGE_APP_PASSWORD_HASH };
|
scripts/command-center.test.mjs
CHANGED
|
@@ -510,6 +510,16 @@ describe('Command center scripts', () => {
|
|
| 510 |
assert.equal(report.service.capabilities.page_sse_declared_supported, true);
|
| 511 |
assert.equal(report.service.capabilities.page_sse_real_smoke, 'not_run_by_first_run');
|
| 512 |
assert.equal(report.service.capabilities.responses_image_backend_real_smoke, 'not_run_by_first_run');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 513 |
assert.match(formatFirstRunText(report), /页面 SSE:声明支持,实测=未执行真实 smoke/);
|
| 514 |
assert.match(formatFirstRunText(report), /Responses 后端:声明未支持,启用=否,实测=未执行真实 smoke/);
|
| 515 |
assert.equal(
|
|
@@ -726,6 +736,13 @@ describe('Command center scripts', () => {
|
|
| 726 |
assert.equal(body.summary.page_sse_auth_ready, false);
|
| 727 |
assert.equal(body.summary.page_sse_declared_supported, true);
|
| 728 |
assert.equal(body.summary.page_sse_real_smoke, 'skipped');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 729 |
assert.equal(body.summary.responses_gpt2image_ready, true);
|
| 730 |
assert.equal(body.summary.responses_image_backend_declared_supported, true);
|
| 731 |
assert.equal(body.summary.billable_smoke, 'skipped');
|
|
@@ -854,6 +871,11 @@ describe('Command center scripts', () => {
|
|
| 854 |
assert.equal(body.service_base_url_source, 'user_provided');
|
| 855 |
assert.equal(body.interactive_confirmation_required, false);
|
| 856 |
assert.equal(body.summary.page_sse_real_smoke, 'passed');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 857 |
assert.ok(hits.includes('/api/agent/images/generate'));
|
| 858 |
assert.ok(hits.includes('/api/images'));
|
| 859 |
}
|
|
|
|
| 510 |
assert.equal(report.service.capabilities.page_sse_declared_supported, true);
|
| 511 |
assert.equal(report.service.capabilities.page_sse_real_smoke, 'not_run_by_first_run');
|
| 512 |
assert.equal(report.service.capabilities.responses_image_backend_real_smoke, 'not_run_by_first_run');
|
| 513 |
+
assert.deepEqual(report.service.capabilities.page_sse_real_smoke_status, {
|
| 514 |
+
state: 'not_run',
|
| 515 |
+
billable: false,
|
| 516 |
+
reason: 'first-run is non-billable and does not call /api/images'
|
| 517 |
+
});
|
| 518 |
+
assert.deepEqual(report.service.capabilities.responses_image_backend_real_smoke_status, {
|
| 519 |
+
state: 'not_run',
|
| 520 |
+
billable: false,
|
| 521 |
+
reason: 'first-run is non-billable and does not call Responses image generation'
|
| 522 |
+
});
|
| 523 |
assert.match(formatFirstRunText(report), /页面 SSE:声明支持,实测=未执行真实 smoke/);
|
| 524 |
assert.match(formatFirstRunText(report), /Responses 后端:声明未支持,启用=否,实测=未执行真实 smoke/);
|
| 525 |
assert.equal(
|
|
|
|
| 736 |
assert.equal(body.summary.page_sse_auth_ready, false);
|
| 737 |
assert.equal(body.summary.page_sse_declared_supported, true);
|
| 738 |
assert.equal(body.summary.page_sse_real_smoke, 'skipped');
|
| 739 |
+
assert.equal(body.summary.responses_page_sse_generate_smoke, 'skipped');
|
| 740 |
+
assert.deepEqual(body.summary.real_smoke_checks, {
|
| 741 |
+
agent_generate_1k: 'skipped',
|
| 742 |
+
responses_page_sse_generate_1k: 'skipped',
|
| 743 |
+
agent_edit_1k: 'skipped',
|
| 744 |
+
page_sse_edit_2k: 'skipped'
|
| 745 |
+
});
|
| 746 |
assert.equal(body.summary.responses_gpt2image_ready, true);
|
| 747 |
assert.equal(body.summary.responses_image_backend_declared_supported, true);
|
| 748 |
assert.equal(body.summary.billable_smoke, 'skipped');
|
|
|
|
| 871 |
assert.equal(body.service_base_url_source, 'user_provided');
|
| 872 |
assert.equal(body.interactive_confirmation_required, false);
|
| 873 |
assert.equal(body.summary.page_sse_real_smoke, 'passed');
|
| 874 |
+
assert.equal(body.summary.responses_page_sse_generate_smoke, 'passed');
|
| 875 |
+
assert.equal(body.summary.real_smoke_checks.agent_generate_1k, 'passed');
|
| 876 |
+
assert.equal(body.summary.real_smoke_checks.responses_page_sse_generate_1k, 'passed');
|
| 877 |
+
assert.equal(body.summary.real_smoke_checks.agent_edit_1k, 'skipped');
|
| 878 |
+
assert.equal(body.summary.real_smoke_checks.page_sse_edit_2k, 'skipped');
|
| 879 |
assert.ok(hits.includes('/api/agent/images/generate'));
|
| 880 |
assert.ok(hits.includes('/api/images'));
|
| 881 |
}
|
scripts/first-run.mjs
CHANGED
|
@@ -329,10 +329,14 @@ function summarizeCapabilitiesBody(body) {
|
|
| 329 |
page_sse_supported: body?.agent_streaming?.page_sse?.supported === true,
|
| 330 |
page_sse_declared_supported: body?.agent_streaming?.page_sse?.supported === true,
|
| 331 |
page_sse_real_smoke: 'not_run_by_first_run',
|
|
|
|
| 332 |
upstream_sse_declared_supported: body?.agent_streaming?.upstream_sse?.supported === true,
|
| 333 |
responses_image_backend_declared_supported: responsesRequirement?.supported === true,
|
| 334 |
responses_image_backend_enabled: responsesRequirement?.enabled === true,
|
| 335 |
-
responses_image_backend_real_smoke: 'not_run_by_first_run'
|
|
|
|
|
|
|
|
|
|
| 336 |
};
|
| 337 |
}
|
| 338 |
|
|
@@ -465,6 +469,14 @@ function formatSmokeState(value) {
|
|
| 465 |
return states[value] || value || '未知';
|
| 466 |
}
|
| 467 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 468 |
function formatAuthState(auth) {
|
| 469 |
if (!auth) return '未知';
|
| 470 |
if (auth.has_token) return '已加载 token';
|
|
|
|
| 329 |
page_sse_supported: body?.agent_streaming?.page_sse?.supported === true,
|
| 330 |
page_sse_declared_supported: body?.agent_streaming?.page_sse?.supported === true,
|
| 331 |
page_sse_real_smoke: 'not_run_by_first_run',
|
| 332 |
+
page_sse_real_smoke_status: buildNotRunSmokeStatus('first-run is non-billable and does not call /api/images'),
|
| 333 |
upstream_sse_declared_supported: body?.agent_streaming?.upstream_sse?.supported === true,
|
| 334 |
responses_image_backend_declared_supported: responsesRequirement?.supported === true,
|
| 335 |
responses_image_backend_enabled: responsesRequirement?.enabled === true,
|
| 336 |
+
responses_image_backend_real_smoke: 'not_run_by_first_run',
|
| 337 |
+
responses_image_backend_real_smoke_status: buildNotRunSmokeStatus(
|
| 338 |
+
'first-run is non-billable and does not call Responses image generation'
|
| 339 |
+
)
|
| 340 |
};
|
| 341 |
}
|
| 342 |
|
|
|
|
| 469 |
return states[value] || value || '未知';
|
| 470 |
}
|
| 471 |
|
| 472 |
+
function buildNotRunSmokeStatus(reason) {
|
| 473 |
+
return {
|
| 474 |
+
state: 'not_run',
|
| 475 |
+
billable: false,
|
| 476 |
+
reason
|
| 477 |
+
};
|
| 478 |
+
}
|
| 479 |
+
|
| 480 |
function formatAuthState(auth) {
|
| 481 |
if (!auth) return '未知';
|
| 482 |
if (auth.has_token) return '已加载 token';
|