XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

ora userid and session token for gpt-4

78662c77
t.me/xtekky <98614666+xtekky@users.noreply.github.com>
提交于

代码差异

4 个文件 +42 -23
Modified README.md +1 -0
@@ -58,6 +58,7 @@ By the way, thank you so much for `2k` stars and all the support!!
58 58 - [`/ora`](./ora/README.md)
59 59 - here is proof / test: [`ora_gpt4_proof.py`](./testing/ora_gpt4_proof.py)
60 60 - why ?, no streaming compared to poe.com but u can send more than 1 message
61 - update: you need to use session token now and there is a limit, accounts are only google so no creator for now
61 62
62 63 #### gpt-3.5
63 64 - [`/sqlchat`](./sqlchat/README.md)
Modified ora/README.md +5 -0
@@ -5,6 +5,10 @@
5 5 more gpt4 models in `/testing/ora_gpt4.py`
6 6
7 7 ```python
8 # if using CompletionModel.load set these
9 ora.user_id = '...'
10 ora.session_token = '...'
11
8 12 # normal gpt-4: b8b12eaa-5d47-44d3-92a6-4d706f2bcacf
9 13 model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
10 14 ```
@@ -14,6 +18,7 @@ model = ora.CompletionModel.load(chatbot_id, 'gpt-4') # or gpt-3.5
14 18 # import ora
15 19 import ora
16 20
21
17 22 # create model
18 23 model = ora.CompletionModel.create(
19 24 system_prompt = 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible',
Modified ora/__init__.py +12 -4
@@ -4,18 +4,23 @@ from requests import post
4 4 from time import time
5 5 from random import randint
6 6
7 user_id = None
8 session_token = None
9
7 10 class Completion:
8 11 def create(
9 12 model : CompletionModel,
10 13 prompt: str,
11 14 includeHistory: bool = True,
12 15 conversationId: str or None = None) -> OraResponse:
13
14 16 extra = {
15 17 'conversationId': conversationId} if conversationId else {}
16 18
17 response = post('https://ora.sh/api/conversation',
18 headers = {
19 cookies = {
20 "cookie" : f"__Secure-next-auth.session-token={session_token}"} if session_token else {}
21
22 response = post('https://ora.sh/api/conversation',
23 headers = cookies | {
19 24 "host" : "ora.sh",
20 25 "authorization" : f"Bearer AY0{randint(1111, 9999)}",
21 26 "user-agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36",
@@ -25,10 +30,13 @@ class Completion:
25 30 json = extra | {
26 31 'chatbotId': model.id,
27 32 'input' : prompt,
28 'userId' : model.createdBy,
33 'userId' : user_id if user_id else model.createdBy,
29 34 'model' : model.modelName,
30 35 'provider' : 'OPEN_AI',
31 36 'includeHistory': includeHistory}).json()
37
38 if response.get('error'):
39 raise Exception('''set ora.user_id and ora.session_token\napi response: %s''' % response['error'])
32 40
33 41 return OraResponse({
34 42 'id' : response['conversationId'],
Modified testing/ora_gpt4.py +24 -19
@@ -1,27 +1,12 @@
1 1 import ora
2 2
3 # 1 normal
4 # 2 solidity contract helper
5 # 3 swift project helper
6 # 4 developer gpt
7 # 5 lawsuit bot for spam call
8 # 6 p5.js code help bot
9 # 8 AI professor, for controversial topics
10 # 9 HustleGPT, your entrepreneurial AI
11 # 10 midjourney prompts bot
12 # 11 AI philosophy professor
13 # 12 TypeScript and JavaScript code review bot
14 # 13 credit card transaction details to merchant and location bot
15 # 15 Chemical Compound Similarity and Purchase Tool bot
16 # 16 expert full-stack developer AI
17 # 17 Solana development bot
18 # 18 price guessing game bot
19 # 19 AI Ethicist and Philosopher
3 ora.user_id = '...'
4 ora.session_token = '...'
20 5
21 6 gpt4_chatbot_ids = ['b8b12eaa-5d47-44d3-92a6-4d706f2bcacf', 'fbe53266-673c-4b70-9d2d-d247785ccd91', 'bd5781cf-727a-45e9-80fd-a3cfce1350c6', '993a0102-d397-47f6-98c3-2587f2c9ec3a', 'ae5c524e-d025-478b-ad46-8843a5745261', 'cc510743-e4ab-485e-9191-76960ecb6040', 'a5cd2481-8e24-4938-aa25-8e26d6233390', '6bca5930-2aa1-4bf4-96a7-bea4d32dcdac', '884a5f2b-47a2-47a5-9e0f-851bbe76b57c', 'd5f3c491-0e74-4ef7-bdca-b7d27c59e6b3', 'd72e83f6-ef4e-4702-844f-cf4bd432eef7', '6e80b170-11ed-4f1a-b992-fd04d7a9e78c', '8ef52d68-1b01-466f-bfbf-f25c13ff4a72', 'd0674e11-f22e-406b-98bc-c1ba8564f749', 'a051381d-6530-463f-be68-020afddf6a8f', '99c0afa1-9e32-4566-8909-f4ef9ac06226', '1be65282-9c59-4a96-99f8-d225059d9001', 'dba16bd8-5785-4248-a8e9-b5d1ecbfdd60', '1731450d-3226-42d0-b41c-4129fe009524', '8e74635d-000e-4819-ab2c-4e986b7a0f48', 'afe7ed01-c1ac-4129-9c71-2ca7f3800b30', 'e374c37a-8c44-4f0e-9e9f-1ad4609f24f5']
22 7 chatbot_id = gpt4_chatbot_ids[0]
23 8
24 model = ora.CompletionModel.load(chatbot_id, 'gpt-4')
9 model = ora.CompletionModel.load(chatbot_id, 'gpt-4')
25 10 response = ora.Completion.create(model, 'hello')
26 11
27 12 print(response.completion.choices[0].text)
@@ -37,4 +22,24 @@ while True:
37 22 includeHistory = True, # remember history
38 23 conversationId = conversation_id)
39 24
40 print(response.completion.choices[0].text)
25 print(response.completion.choices[0].text)
26
27
28 # bots :
29 # 1 normal
30 # 2 solidity contract helper
31 # 3 swift project helper
32 # 4 developer gpt
33 # 5 lawsuit bot for spam call
34 # 6 p5.js code help bot
35 # 8 AI professor, for controversial topics
36 # 9 HustleGPT, your entrepreneurial AI
37 # 10 midjourney prompts bot
38 # 11 AI philosophy professor
39 # 12 TypeScript and JavaScript code review bot
40 # 13 credit card transaction details to merchant and location bot
41 # 15 Chemical Compound Similarity and Purchase Tool bot
42 # 16 expert full-stack developer AI
43 # 17 Solana development bot
44 # 18 price guessing game bot
45 # 19 AI Ethicist and Philosopher