EdgeGPT
EdgeGPT copied to clipboard
[Bug]: Unable to customize cookie record file path using Query
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What happened?
Unable to customize cookie record file path using Query
Steps to reproduce the problem
Save the bing_cookies_0.json file in a subdirectory of the directory where the program is located for example:cookie_file="./newbing_tokens/bing_cookies_0.json"
What should have happened?
Should return str type text normally
Version where the problem happens
0.7.0
What Python version are you running this with?
Python 3.10.6
What is your operating system ?
Other/Cloud
Command Line Arguments
None
Console logs
> Please set Cookie.current_filepath to a valid cookie file, then run Cookie.import_data()
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
File /usr/local/lib/python3.10/dist-packages/EdgeGPT.py:1105, in Cookie.import_data(cls)
1104 try:
-> 1105 cls.current_filepath = cls.files()[cls.current_file_index]
1106 except IndexError as exc:
IndexError: list index out of range
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
Cell In[12], line 35
33 style = newbing_config.get("style")
34 if style and token_path:
---> 35 q = Query(
36 "你是谁?",
37 style=style,
38 cookie_file="newbing_tokens/bing_cookies_0.json"
39 #cookie_file= os.path.join(token_path, get_newbing_JsonFile(token_path))
40 )
41 print(q)
42 else:
File /usr/local/lib/python3.10/dist-packages/EdgeGPT.py:1159, in Query.__init__(self, prompt, style, content_type, cookie_file, echo, echo_prompt, proxy)
1157 self.request_count = {}
1158 self.image_dirpath = Path("./").resolve()
-> 1159 Cookie.import_data()
1160 self.index += [self]
1161 self.prompt = prompt
File /usr/local/lib/python3.10/dist-packages/EdgeGPT.py:1110, in Cookie.import_data(cls)
1106 except IndexError as exc:
1107 print(
1108 "> Please set Cookie.current_filepath to a valid cookie file, then run Cookie.import_data()",
1109 )
-> 1110 raise "No valid cookie file found." from exc
1111 print(f"> Importing cookies from: {cls.current_filepath.name}")
1112 with open(cls.current_filepath, encoding="utf-8") as file:
TypeError: exceptions must derive from BaseException
Additional information
No response