()
| 767 | } |
| 768 | |
| 769 | async function refreshImageGenerationMethod() { |
| 770 | const headers = buildApiHeaders(); |
| 771 | imageGenerationMethod = 'legacy'; |
| 772 | imageGenerationExperimental = false; |
| 773 | |
| 774 | if (!headers.Authorization) { |
| 775 | stopImageContinuous(); |
| 776 | updateImageModeUI(); |
| 777 | return; |
| 778 | } |
| 779 | |
| 780 | try { |
| 781 | const res = await fetch(`/v1/images/method?t=${Date.now()}`, { |
| 782 | headers, |
| 783 | cache: 'no-store', |
| 784 | }); |
| 785 | if (res.ok) { |
| 786 | const data = await res.json().catch(() => ({})); |
| 787 | const method = String(data?.image_generation_method || data?.method || '').trim().toLowerCase(); |
| 788 | imageGenerationMethod = method || 'legacy'; |
| 789 | imageGenerationExperimental = isExperimentalImageMethod(imageGenerationMethod); |
| 790 | } |
| 791 | } catch (e) {} |
| 792 | |
| 793 | if (!imageGenerationExperimental) { |
| 794 | stopImageContinuous(); |
| 795 | } |
| 796 | |
| 797 | updateImageModeUI(); |
| 798 | } |
| 799 | |
| 800 | async function refreshModels() { |
| 801 | const sel = q('model-select'); |
no test coverage detected