返回提交历史
Modified
g4f/gui/client/static/js/chat.v1.js
+7
-6
Modified
g4f/gui/server/api.py
+3
-1
XFEstudio/gpt4free
Fix issue with demo mode Fix issue with share API
2d6ce560
代码差异
2 个文件
+10
-7
@@ -1896,20 +1896,21 @@ async function on_load() {
1896
1896
count_input();
1897
1897
if (/\/settings\//.test(window.location.href)) {
1898
1898
open_settings();
1899
} else if (/\/chat\/[^?]+/.test(window.location.href)) {
1900
load_conversation(window.conversation_id);
1901
} else {
1899
} else if (/\/chat\/share/.test(window.location.href)) {
1902
1900
chatPrompt.value = document.getElementById("systemPrompt")?.value || "";
1903
1901
let chat_url = new URL(window.location.href)
1904
1902
let chat_params = new URLSearchParams(chat_url.search);
1905
1903
if (chat_params.get("prompt")) {
1906
messageInput.value = `${window.location.href}\n`;
1904
messageInput.value = chat_params.get("prompt");
1907
1905
messageInput.style.height = messageInput.scrollHeight + "px";
1908
1906
messageInput.focus();
1909
1907
//await handle_ask();
1910
} else {
1911
say_hello()
1912
1908
}
1909
} else if (/\/chat\/[^?]+/.test(window.location.href)) {
1910
load_conversation(window.conversation_id);
1911
} else {
1912
chatPrompt.value = document.getElementById("systemPrompt")?.value || "";
1913
say_hello();
1913
1914
}
1914
1915
load_conversations();
1915
1916
}
@@ -170,6 +170,8 @@ class Api:
170
170
provider = chunk.name
171
171
elif isinstance(chunk, BaseConversation):
172
172
if provider is not None:
173
if hasattr(provider, "__name__"):
174
provider = provider.__name__
173
175
if provider not in conversations:
174
176
conversations[provider] = {}
175
177
conversations[provider][conversation_id] = chunk
@@ -189,7 +191,7 @@ class Api:
189
191
elif isinstance(chunk, ImageResponse):
190
192
images = chunk
191
193
if download_images or chunk.get("cookies"):
192
chunk.alt = chunk.alt or format_image_prompt(kwargs.get("messages"))
194
chunk.alt = format_image_prompt(kwargs.get("messages"), chunk.alt)
193
195
images = asyncio.run(copy_images(chunk.get_list(), chunk.get("cookies"), proxy=proxy, alt=chunk.alt))
194
196
images = ImageResponse(images, chunk.alt)
195
197
yield self._format_json("content", str(images), images=chunk.get_list(), alt=chunk.alt)