グラジオを使用してハギングフェイススペース
雑談
トークンの作成
You: Hi there, My name is Rawa Chat GPT: Hello Rawa, nice to meet you. Is there something you would like to talk about or ask me? I'm here to help with any questions you may have. You: great, now say my name like Heisenberg Chat GPT: Sure, Rawa like Heisenberg. Is there anything else you would like to talk about? I'm here to help with any questions you may have. You: Sorry I meant like the episode of Breaking Bad where Walter White says Heisenberg Chat GPT: Ah, I see. In that case, you could try saying it like this: "My name is Rawa, like Heisenberg." This is a reference to the character Walter White from the TV show Breaking Bad, who often used the pseudonym "Heisenberg" when conducting illegal activities. The character was known for his cool and calculated demeanor, so saying your name like Heisenberg in this context would mean saying it with confidence and authority.
pip install chatgptpy --upgrade
[ニュー]オブジェクトをコンストラクターに渡してセッションをカスタマイズする
options()
ChatGPT()
[ニュー]会話をファイルに保存できるようになりました
from pychatgpt import Chat, Options
options = Options()
# [New] Enable, Disable logs
options.logs = True
# Track conversation
options.track = True
# Use a proxy
options.proxies = 'http://localhost:8080'
# Optionally, you can pass a file path to save the conversation
# They're created if they don't exist
# options.chat_log = "chat_log.txt"
# options.id_log = "id_log.txt"
# Create a Chat object
chat = Chat(email="email", password="password", options=options)
answer = chat.ask("How are you?")
print(answer)
[ニュー]会話を再開する
from pychatgpt import Chat
# Create a Chat object
chat = Chat(email="email", password="password",
conversation_id="Parent Conversation ID",
previous_convo_id="Previous Conversation ID")
answer, parent_conversation_id, conversation_id = chat.ask("How are you?")
print(answer)
# Or change the conversation id later
answer, _, _ = chat.ask("How are you?",
previous_convo_id="Parent Conversation ID",
conversation_id="Previous Conversation ID")
print(answer)
CLI セッションの開始
from pychatgpt import Chat
chat = Chat(email="email", password="password")
chat.cli_chat()
1 回限りの質問をする
from pychatgpt import Chat
# Initializing the chat class will automatically log you in, check access_tokens
chat = Chat(email="email", password="password")
answer, parent_conversation_id, conversation_id = chat.ask("Hello!")
import time
from pychatgpt import OpenAI
# Manually set the token
OpenAI.Auth(email_address="email", password="password").save_access_token(access_token="", expiry=time.time() + 3600)
# Get the token, expiry
access_token, expiry = OpenAI.get_access_token()
# Check if the token is valid
is_expired = OpenAI.token_expired() # Returns True or False
pip install chatgptpy --upgrade
answer, previous_convo, convo_id
options()
action=next
action=variant
action=variant
action=next
502 Bad Gateway
トークン作成プロセスが失敗した場合:
次のようないくつかの機能を追加する予定です。
私は新しいチャットGPT APIと対話する方法を探していましたが、ここGitHubのほとんどのソースは Chromiumインスタンスをバックグラウンドで実行する必要があります。または、Web インスペクターを使用してアクセス トークンを手動で取得します。
これ以上はない。APIをリバースエンジニアリングし、TLSクライアントを使用して実際のユーザーを模倣し、Auth0によるボット検出手法をオフにせずにスクリプトがログインできるようにしました。
基本的に、スクリプトはTLSクライアントを使用してユーザーに代わってログインし、アクセストークンを取得します。それはかなり速いです。
まず、「httpリクエストを作成するだけでは十分ではなく、Auth0はスマートで、各プロセスはJWTトークンであるトークンによって保護されています。このトークンは、CSRF攻撃を防ぐために使用され、ボットがログインするのを防ぐためにも使用されます。 ファイルを見ると、9つ以上の関数があり、それぞれが異なるタスクを担当しており、それらはすべて 協力してトークンを作成します。 ログインプロセスをナビゲートできるため、これには大きな役割を果たしました
state
auth.py
allow-redirects
私は MeshMonitors.io で働いています、私たちは素晴らしいツールを作ります(それをチェックしてください!私はこれにあまり時間をかけないことに決めましたが、ここにいます。
誰もこれを行うことができなかったので、私は私ができるかどうかを見たかったのです。