Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #161 from CBoYXD/main
Browse files Browse the repository at this point in the history
Some Update
  • Loading branch information
dsdanielpark authored Aug 9, 2023
2 parents cd759f5 + fad7741 commit 44f353e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions bardapi/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(
token: str = None,
timeout: int = 20,
proxies: dict = None,
google_translator_api_key: str = None,
session: requests.Session = None,
language: str = None,
):
Expand Down Expand Up @@ -70,11 +71,13 @@ def __init__(
or print("Bard API(__Secure-1PSID) Key must be entered.")
)
self.proxies = proxies
self.google_translator_api_key = google_translator_api_key

# Set Bard object
self.bard = Bard(
token=self.token,
session=self.session,
google_translator_api_key=self.google_translator_api_key,
timeout=self.timeout,
language=self.language,
proxies=self.proxies,
Expand Down
11 changes: 6 additions & 5 deletions documents/README_DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ audio = bard.speech("Hello, I am bard! How can I assist you?", lang='en-US') # G
# Save audio object.
with open('bard_response.mp3', 'wb') as f:
f.write(audio)
f.write(audio['audio'])
```
<br>
Expand Down Expand Up @@ -167,6 +167,7 @@ from bardapi import Bard
bard = Bard(token='xxxxxxxx')
image = open('image.jpg', 'rb').read() # (jpeg, png, webp) are supported.
bard_answer = bard.ask_about_image('What is in the image?', image)
print(bard_answer['content'])
```
<br>
Expand Down Expand Up @@ -231,7 +232,7 @@ from bardapi import Bard
bard = Bard(token='xxxxxxxx')
bard_answer = bard.get_answer('How are you?')
url = bard.export_conversation(bard_answer, title='Example Shared conversation')
print(url)
print(url['url'])
```
Expand All @@ -249,7 +250,7 @@ url = bard.export_replit(
code=bard_answer['code'],
langcode=bard_answer['langCode'],
)
print(url) # https://replit.com/external/v1/claims/xxx/claim
print(url['url']) # https://replit.com/external/v1/claims/xxx/claim
```
<br>
Expand Down Expand Up @@ -300,7 +301,7 @@ cookie_dict = {
}
bard = BardCookies(cookie_dict=cookie_dict)
print(bard.get_answer("こんにちは"))
print(bard.get_answer("こんにちは")['content'])
```
<br>
Expand Down Expand Up @@ -374,7 +375,7 @@ chat.start()
#### Features
Customize User Prompt
Users can customize the prompt displayed to the user before input by providing a custom prompt message to the start() method.
```pythno
```python
chat.start(prompt="Enter your message: ")
```
Expand Down

0 comments on commit 44f353e

Please sign in to comment.