XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Fix unittests

344034fe
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

2 个文件 +11 -3
Modified g4f/api/__init__.py +4 -0
@@ -408,11 +408,15 @@ class Api:
408 408 @self.app.post("/v1/media/generate", responses=responses)
409 409 @self.app.post("/v1/images/generate", responses=responses)
410 410 @self.app.post("/v1/images/generations", responses=responses)
411 @self.app.post("/api/{provider}/images/generations", responses=responses)
411 412 async def generate_image(
412 413 request: Request,
413 414 config: ImageGenerationConfig,
415 provider: str = None,
414 416 credentials: Annotated[HTTPAuthorizationCredentials, Depends(Api.security)] = None
415 417 ):
418 if config.provider is None:
419 config.provider = provider
416 420 if credentials is not None and credentials.credentials != "secret":
417 421 config.api_key = credentials.credentials
418 422 try:
Modified g4f/gui/client/static/js/chat.v1.js +7 -3
@@ -1641,7 +1641,7 @@ const remove_message = async (conversation_id, index) => {
1641 1641 }
1642 1642 conversation.items = new_items;
1643 1643 await save_conversation(conversation_id, conversation);
1644 if (window.chat_id) {
1644 if (window.chat_id && window.conversation_id == window.start_id) {
1645 1645 const url = `${window.share_url}/backend-api/v2/chat/${window.chat_id}`;
1646 1646 await fetch(url, {
1647 1647 method: 'POST',
@@ -1717,7 +1717,7 @@ const add_message = async (
1717 1717 conversation.items = new_messages;
1718 1718 }
1719 1719 await save_conversation(conversation_id, conversation);
1720 if (window.chat_id) {
1720 if (window.chat_id && conversation_id == window.start_id) {
1721 1721 const url = `${window.share_url}/backend-api/v2/chat/${window.chat_id}`;
1722 1722 fetch(url, {
1723 1723 method: 'POST',
@@ -2112,7 +2112,11 @@ window.addEventListener('load', async function() {
2112 2112 return;
2113 2113 }
2114 2114 const response = await fetch(`${window.share_url}/backend-api/v2/chat/${window.chat_id}`, {
2115 headers: {'accept': 'application/json', 'if-none-match': conversation.updated},
2115 headers: {
2116 'accept': 'application/json',
2117 'if-none-match': conversation.updated,
2118 'x-conversation-id': conversation.id,
2119 },
2116 2120 });
2117 2121 if (response.status == 200) {
2118 2122 const new_conversation = await response.json();