Kaveen Kumarasinghe 2 years ago
parent 05fdf2d784
commit 8e94277f2b

@ -1070,7 +1070,7 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
"""Message command. Return the message"""
prompt = await self.mention_to_username(ctx, message.content)
await self.ask_command(
ctx, prompt, None, None, None, None, from_ask_action=prompt
ctx, prompt,private=False,temperature= None,top_p= None,frequency_penalty= None,presence_penalty= None, from_ask_action=prompt
)
async def paraphrase_action(self, ctx, message: discord.Message):
@ -1092,7 +1092,7 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
return
await self.ask_command(
ctx, prompt, None, None, None, None, from_other_action=from_other_action
ctx, prompt, private=False, temperature= None, top_p=None, frequency_penalty=None, presence_penalty=None, from_other_action=from_other_action
)
async def elaborate_action(self, ctx, message: discord.Message):
@ -1104,6 +1104,7 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
# Construct the paraphrase prompt
prompt = f"Elaborate with more information about the subject of the following message. Be objective and detailed and respond with elaborations only about the subject(s) of the message: {prompt} \n\nElaboration:"
tokens = self.model.usage_service.count_tokens(prompt)
if tokens > self.model.max_tokens - 500:
await ctx.respond(
@ -1114,7 +1115,7 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
return
await self.ask_command(
ctx, prompt, None, None, None, None, from_other_action=from_other_action
ctx, prompt=prompt, private=False, temperature=None,top_p=None, frequency_penalty=None, presence_penalty=None, from_other_action=from_other_action
)
async def summarize_action(self, ctx, message: discord.Message):
@ -1138,5 +1139,5 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
return
await self.ask_command(
ctx, prompt, None, None, None, None, from_other_action=from_other_action
ctx, prompt,private=False, temperature=None, top_p=None, frequency_penalty=None, presence_penalty=None, from_other_action=from_other_action
)

@ -31,7 +31,7 @@ from services.environment_service import EnvService
from models.openai_model import Model
__version__ = "10.0.0"
__version__ = "10.1.1"
PID_FILE = Path("bot.pid")

@ -68,6 +68,16 @@ class Search:
# Concatenate all the text for a given website into one string and save it into an array:
documents = []
for link in links:
# First, attempt a connection with a timeout of 3 seconds to the link, if the timeout occurs, don't
# continue to the document loading.
try:
async with aiohttp.ClientSession() as session:
async with session.get(link, timeout=3) as response:
pass # Only catch timeout errors, allow for redirects for now..
except:
traceback.print_exc()
continue
try:
document = await self.loop.run_in_executor(
None, partial(self.index_webpage, link)
@ -76,7 +86,6 @@ class Search:
except Exception as e:
traceback.print_exc()
index = GPTSimpleVectorIndex(documents)
# Now we can search the index for a query:

Loading…
Cancel
Save