1
0
Fork 0

Merge pull request #144 from Joonsey/main

fixes #143 missing cf_clearance raises error
This commit is contained in:
t.me/xtekky 2023-04-26 08:54:44 +01:00 committed by GitHub
commit 0265144b38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,6 +55,8 @@ class Search:
def create(prompt: str, actualSearch: bool = True, language: str = 'en') -> dict: # None = no search def create(prompt: str, actualSearch: bool = True, language: str = 'en') -> dict: # None = no search
if user_agent == '': if user_agent == '':
raise ValueError('user_agent must be set, refer to documentation') raise ValueError('user_agent must be set, refer to documentation')
if cf_clearance == '' :
raise ValueError('cf_clearance must be set, refer to documentation')
if not actualSearch: if not actualSearch:
return { return {
@ -106,8 +108,11 @@ class Completion:
codeContext: str = '', codeContext: str = '',
language: str = 'en') -> PhindResponse: language: str = 'en') -> PhindResponse:
if user_agent == '': if user_agent == '' :
raise ValueError('user_agent must be set, refer to documentation') raise ValueError('user_agent must be set, refer to documentation')
if cf_clearance == '' :
raise ValueError('cf_clearance must be set, refer to documentation')
if results is None: if results is None:
results = Search.create(prompt, actualSearch = True) results = Search.create(prompt, actualSearch = True)
@ -235,6 +240,8 @@ class StreamingCompletion:
if user_agent == '': if user_agent == '':
raise ValueError('user_agent must be set, refer to documentation') raise ValueError('user_agent must be set, refer to documentation')
if cf_clearance == '' :
raise ValueError('cf_clearance must be set, refer to documentation')
if results is None: if results is None:
results = Search.create(prompt, actualSearch = True) results = Search.create(prompt, actualSearch = True)
@ -281,4 +288,4 @@ class StreamingCompletion:
@staticmethod @staticmethod
def handle_stream_response(response): def handle_stream_response(response):
StreamingCompletion.message_queue.put(response) StreamingCompletion.message_queue.put(response)