Your task is to review pull requests. Instructions:
- Provide the response in following JSON format: {"reviews": [{"line": <line_number>, "body": "<review comment>"}]}
- Do not give positive comments or compliments.
- Provide comments and suggestions ONLY if there is something to improve, otherwise "reviews" should be an empty array.
- Write the comment in GitHub Markdown format.
- Use the given description only for the overall context and only comment the code.
- IMPORTANT: NEVER suggest adding comments to the code.

Review the following code diff in the file "g4f/Provider/HuggingChat.py" and take the pull request title and description into account when writing the response.
  
Pull request title: [pull] main from xtekky:main
Pull request description:
---
See [Commits](/Martintianzy/gpt4free/pull/130/commits) and [Changes](/Martintianzy/gpt4free/pull/130/files) for more details.

-----
Created by [<img src="https://prod.download/pull-18h-svg" valign="bottom"/> **pull[bot]**](https://github.com/wei/pull)

_Can you help keep this open source service alive? **[💖 Please sponsor : )](https://prod.download/pull-pr-sponsor)**_
---

Each line is prefixed by its number. Code to review:
```
3: import json
4: import requests
5: 
-from curl_cffi import requests as cf_reqs
6:+try:
7:+    from curl_cffi import requests as cf_reqs
8:+    has_curl_cffi = True
9:+except ImportError:
10:+    has_curl_cffi = False
11: from ..typing import CreateResult, Messages
12:+from ..errors import MissingRequirementsError
13: from .base_provider import ProviderModelMixin, AbstractProvider
14: from .helper import format_prompt
15: 
24:         'CohereForAI/c4ai-command-r-plus-08-2024',
25:         'Qwen/Qwen2.5-72B-Instruct',
26:         'nvidia/Llama-3.1-Nemotron-70B-Instruct-HF',
27:+        'Qwen/Qwen2.5-Coder-32B-Instruct',
28:         'meta-llama/Llama-3.2-11B-Vision-Instruct',
29:         'NousResearch/Hermes-3-Llama-3.1-8B',
30:         'mistralai/Mistral-Nemo-Instruct-2407',
36:         "command-r-plus": "CohereForAI/c4ai-command-r-plus-08-2024",
37:         "qwen-2-72b": "Qwen/Qwen2.5-72B-Instruct",
38:         "nemotron-70b": "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
39:+        "qwen-2.5-coder-32b": "Qwen/Qwen2.5-Coder-32B-Instruct",
40:         "llama-3.2-11b": "meta-llama/Llama-3.2-11B-Vision-Instruct",
41:         "hermes-3": "NousResearch/Hermes-3-Llama-3.1-8B",
42:         "mistral-nemo": "mistralai/Mistral-Nemo-Instruct-2407",
60:         stream: bool,
61:         **kwargs
62:     ) -> CreateResult:
63:+        if not has_curl_cffi:
64:+            raise MissingRequirementsError('Install "curl_cffi" package | pip install -U curl_cffi')
65:         model = cls.get_model(model)
66:         
67:         if model in cls.models:
92:                 raise RuntimeError(f"Request failed with status code: {response.status_code}, response: {response.text}")
93: 
94:             conversationId = response.json().get('conversationId')
95:+            
96:+            # Get the data response and parse it properly
97:             response = session.get(f'https://huggingface.co/chat/conversation/{conversationId}/__data.json?x-sveltekit-invalidated=11')
98:+            
99:+            # Split the response content by newlines and parse each line as JSON
100:+            try:
101:+                json_data = None
102:+                for line in response.text.split('\n'):
103:+                    if line.strip():
104:+                        try:
105:+                            parsed = json.loads(line)
106:+                            if isinstance(parsed, dict) and "nodes" in parsed:
107:+                                json_data = parsed
108:+                                break
109:+                        except json.JSONDecodeError:
110:+                            continue
111:+                            
112:+                if not json_data:
113:+                    raise RuntimeError("Failed to parse response data")
114:+
115:+                data: list = json_data["nodes"][1]["data"]
116:+                keys: list[int] = data[data[0]["messages"]]
117:+                message_keys: dict = data[keys[0]]
118:+                messageId: str = data[message_keys["id"]]
119: 
-            data: list = response.json()["nodes"][1]["data"]
-            keys: list[int] = data[data[0]["messages"]]
-            message_keys: dict = data[keys[0]]
-            messageId: str = data[message_keys["id"]]
120:+            except (KeyError, IndexError, TypeError) as e:
121:+                raise RuntimeError(f"Failed to extract message ID: {str(e)}")
122: 
123:             settings = {
124:                 "inputs": format_prompt(messages),
150:                 'data': (None, json.dumps(settings, separators=(',', ':'))),
151:             }
152: 
-            response = requests.post(f'https://huggingface.co/chat/conversation/{conversationId}',
153:+            response = requests.post(
154:+                f'https://huggingface.co/chat/conversation/{conversationId}',
155:                 cookies=session.cookies,
156:                 headers=headers,
157:                 files=files,
173:                 elif line["type"] == "stream":
174:                     token = line["token"].replace('\u0000', '')
175:                     full_response += token
176:+                    if stream:
177:+                        yield token
178:                 
179:                 elif line["type"] == "finalAnswer":
180:                     break
181:             
182:             full_response = full_response.replace('<|im_end|', '').replace('\u0000', '').strip()
183: 
-            yield full_response
184:+            if not stream:
185:+                yield full_response
186:+
187:+    @classmethod
188:+    def supports_model(cls, model: str) -> bool:
189:+        """Check if the model is supported by the provider."""
190:+        return model in cls.models or model in cls.model_aliases
```