Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Fix conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
terry3041 committed Dec 6, 2022
1 parent d6ae17e commit abf2225
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pyChatGPT"
version = "0.0.4"
version = "0.0.5"
authors = [
{ name="terry3041", email="[email protected]" },
]
Expand Down
6 changes: 4 additions & 2 deletions src/pyChatGPT/pyChatGPT.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ def send_message(self, message: str) -> dict:
try:
data = list(resp.iter_lines())[-4].decode('utf-8').lstrip('data: ')
data = json.loads(data)
self.conversation_id = data['conversation_id']
self.parent_id = data['message']['id']
return {
'message': data['message']['content']['parts'][0],
'conversation_id': data['conversation_id'],
'parent_id': data['message']['id'],
'conversation_id': self.conversation_id,
'parent_id': self.parent_id,
}
except IndexError:
data = resp.json()
Expand Down

0 comments on commit abf2225

Please sign in to comment.