Spaces:
Sleeping
Sleeping
File size: 1,084 Bytes
61bb677 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # Patch openai_chat/provider.py
with open('src/free_claude_code/providers/openai_chat/provider.py', 'r', encoding='utf-8') as f:
code = f.read()
if 'def _get_client(self):' not in code:
code = code.replace(
' def _build_request_body(',
' def _get_client(self):\n return self._client\n\n def _build_request_body('
)
with open('src/free_claude_code/providers/openai_chat/provider.py', 'w', encoding='utf-8') as f:
f.write(code)
# Patch nvidia_nim/client.py
with open('src/free_claude_code/providers/nvidia_nim/client.py', 'r', encoding='utf-8') as f:
code = f.read()
if 'def _get_client(self):' not in code:
func = '''
def _get_client(self):
if hasattr(self, '_rotator') and self._rotator:
return self._rotator.get_client()
return self._client
'''
code = code.replace(
' def _build_request_body(',
f'{func}\n def _build_request_body('
)
with open('src/free_claude_code/providers/nvidia_nim/client.py', 'w', encoding='utf-8') as f:
f.write(code)
|