返回提交历史
Modified
g4f/Provider/qwen/QwenCode.py
+2
-2
Modified
g4f/Provider/qwen/sharedTokenManager.py
+2
-2
XFEstudio/gpt4free
Improve error handling in QwenCode and update credential file path retrieval in SharedTokenManager
6a6a25fb
代码差异
2 个文件
+4
-4
@@ -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()
@@ -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}"))