Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

Add Function to open a website #1

Open
priyanshuverma-dev opened this issue Oct 2, 2023 · 19 comments
Open

Add Function to open a website #1

priyanshuverma-dev opened this issue Oct 2, 2023 · 19 comments
Assignees

Comments

@priyanshuverma-dev
Copy link
Owner

Write an "if" statement to open a website when a user says any keyword in a query.

@priyanshuverma-dev priyanshuverma-dev added enhancement New feature or request good first issue Good for newcomers hacktoberfest labels Oct 2, 2023
@sukhmani1303
Copy link

sukhmani1303 commented Oct 2, 2023

I would love to contribute to this issue. Can you elaborate on the issue a little more, please?

@imkrishnasarathi
Copy link
Contributor

I would like to contribute to this, but I need to know what website needs to be opened, like more details

@priyanshuverma-dev
Copy link
Owner Author

Any website that user wants like:
user says: please open YouTube for me.
user says: open google.com

@imkrishnasarathi
Copy link
Contributor

I am a bit busy today. Please wait. I will send a PR by today night if I complete it :)

@imkrishnasarathi
Copy link
Contributor

imkrishnasarathi commented Oct 3, 2023

When I run your program:-
Traceback (most recent call last): File "C:\Users\HP\PycharmProjects\bard-chatbot\bard.py", line 2, in <module> from bardapi import BardCookies File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\__init__.py", line 4, in <module> from bardapi.core import Bard File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\core.py", line 28, in <module> from bardapi.models.result import BardResult File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\models\result.py", line 3, in <module> from bardapi.models.draft import BardDraft File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\models\draft.py", line 9, in <module> from bardapi.models.tools.map import BardMapContent File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\models\tools\map.py", line 6, in <module> class BardMapsPoint: File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\models\tools\map.py", line 58, in BardMapsPoint def title(self) -> Tuple[str, str]: ^^^^^ NameError: name 'Tuple' is not defined. Did you mean: 'tuple'?

@imkrishnasarathi
Copy link
Contributor

If I go ahead and edit the map.py to have from typing import Tuple, I get this

C:\Users\HP\PycharmProjects\bard-chatbot\venv\Scripts\python.exe C:\Users\HP\PycharmProjects\bard-chatbot\bard.py 
Traceback (most recent call last):
  File "C:\Users\HP\PycharmProjects\bard-chatbot\bard.py", line 2, in <module>
    from bardapi import BardCookies, Bard
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\__init__.py", line 4, in <module>
    from bardapi.core import Bard
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\core.py", line 28, in <module>
    from bardapi.models.result import BardResult
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\models\result.py", line 3, in <module>
    from bardapi.models.draft import BardDraft
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\models\draft.py", line 9, in <module>
    from bardapi.models.tools.map import BardMapContent
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\models\tools\map.py", line 124, in <module>
    class BardMapsDirections:
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\models\tools\map.py", line 141, in BardMapsDirections
    def sections(self) -> List[BardMapsRoadSection]:
                          ^^^^
NameError: name 'List' is not defined. Did you mean: 'list'?

Process finished with exit code 1

@priyanshuverma-dev
Copy link
Owner Author

See the readme file:
(Optional) Make changes in .venv\Lib\site-packages\bardapi\core.py if gives any error like requests not found.

add at top:

import requests

(Optional) Make changes in ..venv\Lib\site-packages\bardapi\models\tools\map.py if gives any error like Tuple not found.
add at top:

from typing import Optional, Tuple, List

@priyanshuverma-dev
Copy link
Owner Author

priyanshuverma-dev commented Oct 3, 2023

If I go ahead and edit the map.py to have from typing import Tuple, I get this

C:\Users\HP\PycharmProjects\bard-chatbot\venv\Scripts\python.exe C:\Users\HP\PycharmProjects\bard-chatbot\bard.py 
Traceback (most recent call last):
  File "C:\Users\HP\PycharmProjects\bard-chatbot\bard.py", line 2, in <module>
    from bardapi import BardCookies, Bard
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\__init__.py", line 4, in <module>
    from bardapi.core import Bard
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\core.py", line 28, in <module>
    from bardapi.models.result import BardResult
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\models\result.py", line 3, in <module>
    from bardapi.models.draft import BardDraft
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\models\draft.py", line 9, in <module>
    from bardapi.models.tools.map import BardMapContent
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\models\tools\map.py", line 124, in <module>
    class BardMapsDirections:
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\models\tools\map.py", line 141, in BardMapsDirections
    def sections(self) -> List[BardMapsRoadSection]:
                          ^^^^
NameError: name 'List' is not defined. Did you mean: 'list'?

Process finished with exit code 1

do this:
(Optional) Make changes in C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\models\tools\map.py if gives any error like Tuple not found.
add at top:

from typing import Optional, Tuple, List

@imkrishnasarathi

@imkrishnasarathi
Copy link
Contributor

ok thanks. I got a school assignment today, so I couldn't keep my words. I will try to complete it by tmmro noon. Please don't reassign it to anyone :)

@priyanshuverma-dev
Copy link
Owner Author

@imkrishnasarathi Not problem. I am also a school student I can understand. I will not unassign you. As we are friends.👏

@imkrishnasarathi
Copy link
Contributor

Now this :-

Traceback (most recent call last):
  File "C:\Users\HP\PycharmProjects\bard-chatbot\bard.py", line 2, in <module>
    from bardapi import BardCookies, Bard
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\__init__.py", line 4, in <module>
    from bardapi.core import Bard
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\core.py", line 39, in <module>
    class Bard:
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\core.py", line 49, in Bard
    session: Optional[requests.Session] = None,
                      ^^^^^^^^
NameError: name 'requests' is not defined

@imkrishnasarathi
Copy link
Contributor

If I import requests in the core.py file, then I get this:-

Traceback (most recent call last):
  File "C:\Users\HP\PycharmProjects\bard-chatbot\bard.py", line 33, in <module>
    bard = BardCookies(cookie_dict=bard_dict, language="english")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\core_cookies.py", line 53, in __init__
    self.SNlM0e = self._get_snim0e()
                  ^^^^^^^^^^^^^^^^^^
  File "C:\Users\HP\PycharmProjects\bard-chatbot\venv\Lib\site-packages\bardapi\core_cookies.py", line 119, in _get_snim0e
    raise Exception(
Exception: SNlM0e value not found in response. Check __Secure-1PSID value.

@priyanshuverma-dev
Copy link
Owner Author

Add .env file. Check readme.md and contributing.md for that @imkrishnasarathi .
You will get token from bard.google.com
In cookies:

@imkrishnasarathi
Copy link
Contributor

Ok thanks

@imkrishnasarathi
Copy link
Contributor

Done. Submitted a PR

@sukhmani1303
Copy link

🚨 I don't think the issue is resolved yet... this issue is not just any if-else type of problem as context & sentiment must also be considered. For example; if someone types "I cannot open youtube.com due to XYZ error. What should I do?" In this case, @imkrishnasarathi 's code will open the website but that was not what the user asked for.
The solution to this issue is relatively comprehensive where you need to identify if the user wants to open a website or wants an answer. This can be solved by either training your own model using custom data (query - answer) which is for this particular task only or using any other pre-trained summarize etc.... & based on its output we can decide if to open a webpage or provide an answer @p7uverma

@imkrishnasarathi
Copy link
Contributor

imkrishnasarathi commented Oct 5, 2023 via email

@priyanshuverma-dev
Copy link
Owner Author

@sukhmani1303 Got you! If you're able to do that try and fix this. I have assigned you this task.

@sukhmani1303
Copy link

It's a very comprehensive issue actually... will take a lot of time but i will try 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants