monra commited on
Commit
9056a26
1 Parent(s): 649b258

Fix Provider ChatGPTAI with GPT-4 model

Browse files
client/html/index.html CHANGED
@@ -81,7 +81,7 @@
81
  <option value="gpt-3.5-turbo-16k-0613" selected>
82
  GPT-3.5-turbo-16k-0613
83
  </option>
84
- <option value="gpt-4" disabled>GPT-4 (offline)</option>
85
  </select>
86
  </div>
87
  <div class="field">
 
81
  <option value="gpt-3.5-turbo-16k-0613" selected>
82
  GPT-3.5-turbo-16k-0613
83
  </option>
84
+ <option value="gpt-4">GPT-4</option>
85
  </select>
86
  </div>
87
  <div class="field">
g4f/Provider/Providers/ChatgptAi.py CHANGED
@@ -7,14 +7,14 @@ model = ['gpt-4']
7
  supports_stream = True
8
  needs_auth = False
9
 
 
10
  def _create_completion(model: str, messages: list, stream: bool, **kwargs):
11
  chat = ''
12
  for message in messages:
13
  chat += '%s: %s\n' % (message['role'], message['content'])
14
  chat += 'assistant: '
15
 
16
- response = requests.get('https://chatgpt.ai/gpt-4/')
17
-
18
  nonce, post_id, _, bot_id = re.findall(r'data-nonce="(.*)"\n data-post-id="(.*)"\n data-url="(.*)"\n data-bot-id="(.*)"\n data-width', response.text)[0]
19
 
20
  headers = {
 
7
  supports_stream = True
8
  needs_auth = False
9
 
10
+
11
  def _create_completion(model: str, messages: list, stream: bool, **kwargs):
12
  chat = ''
13
  for message in messages:
14
  chat += '%s: %s\n' % (message['role'], message['content'])
15
  chat += 'assistant: '
16
 
17
+ response = requests.get('https://chatgpt.ai/')
 
18
  nonce, post_id, _, bot_id = re.findall(r'data-nonce="(.*)"\n data-post-id="(.*)"\n data-url="(.*)"\n data-bot-id="(.*)"\n data-width', response.text)[0]
19
 
20
  headers = {
g4f/models.py CHANGED
@@ -35,7 +35,7 @@ class Model:
35
  class gpt_4:
36
  name: str = 'gpt-4'
37
  base_provider: str = 'openai'
38
- best_provider: Provider.Provider = Provider.Dfehub
39
 
40
  class gpt_4_0613:
41
  name: str = 'gpt-4-0613'
 
35
  class gpt_4:
36
  name: str = 'gpt-4'
37
  base_provider: str = 'openai'
38
+ best_provider: Provider.Provider = Provider.ChatgptAi
39
 
40
  class gpt_4_0613:
41
  name: str = 'gpt-4-0613'