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

XFEstudio/gpt4free

Improve error handling in QwenCode and update credential file path retrieval in SharedTokenManager

6a6a25fb
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

2 个文件 +4 -4
Modified g4f/Provider/qwen/QwenCode.py +2 -2
@@ -40,8 +40,8 @@ class QwenCode(OpenaiTemplate):
40 40 if chunk != last_chunk:
41 41 yield chunk
42 42 last_chunk = chunk
43 except TokenManagerError:
44 raise MissingAuthError("QwenCode: No valid authentication available. Run the oauth flow to authenticate. | python -m g4f.Provider.qwen.oauthFlow")
43 except TokenManagerError as e:
44 raise MissingAuthError(f"QwenCode: No valid authentication available: {e}")
45 45 except MissingAuthError:
46 46 await cls.client.shared_manager.getValidCredentials(cls.client.qwen_client, True)
47 47 creds = await cls.client.get_valid_token()
Modified g4f/Provider/qwen/sharedTokenManager.py +2 -2
@@ -60,10 +60,10 @@ class SharedTokenManager(AuthFileMixin):
60 60 return cls._instance
61 61
62 62 def getCredentialFilePath(self):
63 path = SharedTokenManager.get_cache_file()
63 path = Path(os.path.expanduser(f"~/{QWEN_DIR}/{QWEN_CREDENTIAL_FILENAME}"))
64 64 if path.is_file():
65 65 return path
66 return Path(os.path.expanduser(f"~/{QWEN_DIR}/{QWEN_CREDENTIAL_FILENAME}"))
66 return SharedTokenManager.get_cache_file()
67 67
68 68 def getLockFilePath(self):
69 69 return Path(os.path.expanduser(f"~/{QWEN_DIR}/{QWEN_LOCK_FILENAME}"))