MCPcopy Create free account
hub / github.com/TQZHR/grok2api / refreshImageGenerationMethod

Function refreshImageGenerationMethod

app/static/chat/chat.js:769–798  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

767}
768
769async 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
800async function refreshModels() {
801 const sel = q('model-select');

Callers 3

initFunction · 0.85
saveApiKeyFunction · 0.85
switchTabFunction · 0.85

Calls 4

buildApiHeadersFunction · 0.85
stopImageContinuousFunction · 0.85
updateImageModeUIFunction · 0.85

Tested by

no test coverage detected