fix: hfprovider

This commit is contained in:
0xMRTT 2023-08-03 13:22:00 +02:00
parent 9d3723eebe
commit 8feb2281bc
1 changed files with 7 additions and 2 deletions

View File

@ -24,5 +24,10 @@ class BaseHFChatProvider(BaseProvider):
})
print(output)
return output['generated_text']
if 'generated_text' in output:
return output['generated_text']
elif 'error' in output:
match output['error']:
case "Rate limit reached. Please log in or use your apiToken":
return _("You've reached the rate limit! Please add a token to the preferences. You can get the token by following this [guide](https://bavarder.codeberg.page/help/huggingface/)")