Kaveen Kumarasinghe 1 year ago
parent a323568956
commit 8f4855cacc

@ -18,11 +18,12 @@ PRE_MODERATE = EnvService.get_premoderate()
class RedoSearchUser:
def __init__(self, ctx, query, search_scope, nodes):
def __init__(self, ctx, query, search_scope, nodes, response_mode):
self.ctx = ctx
self.query = query
self.search_scope = search_scope
self.nodes = nodes
self.response_mode = response_mode
class SearchService(discord.Cog, name="SearchService"):
@ -174,7 +175,7 @@ class SearchService(discord.Cog, name="SearchService"):
custom_view=SearchView(ctx, self, query_response_message),
)
self.redo_users[ctx.user.id] = RedoSearchUser(ctx, query, search_scope, nodes)
self.redo_users[ctx.user.id] = RedoSearchUser(ctx, query, search_scope, nodes, response_mode)
await paginator.respond(ctx.interaction)
@ -232,6 +233,7 @@ class RedoButton(discord.ui.Button["SearchView"]):
self.search_cog.redo_users[self.ctx.user.id].nodes,
deep=False,
redo=True,
response_mode=self.search_cog.redo_users[self.ctx.user.id].response_mode,
)
@ -289,4 +291,5 @@ class FollowupModal(discord.ui.Modal):
deep=False,
redo=True,
from_followup=FollowupData(message_link, self.children[0].value),
response_mode=self.search_cog.redo_users[self.ctx.user.id].response_mode,
)

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

@ -19,3 +19,4 @@ python-pptx==0.6.21
sentence-transformers==2.2.2
langchain==0.0.93
openai-whisper
unidecode==1.3.6

@ -16,4 +16,5 @@ youtube_transcript_api==0.5.0
sentencepiece==0.1.97
protobuf==3.20.2
python-pptx==0.6.21
langchain==0.0.93
langchain==0.0.93
unidecode==1.3.6

@ -5,6 +5,7 @@ import traceback
import aiohttp
import discord
from discord.ext import pages
import unidecode
from models.embed_statics_model import EmbedStatics
from services.deletion_service import Deletion
@ -99,7 +100,8 @@ class TextService:
conversation_id = ctx.channel.id
# Create an embedding and timestamp for the prompt
new_prompt = prompt.encode("ascii", "ignore").decode()
#new_prompt = prompt.encode("ascii", "ignore").decode()
new_prompt = unidecode.unidecode(new_prompt)
prompt_less_author = f"{new_prompt} <|endofstatement|>\n"
user_displayname = (
@ -107,7 +109,8 @@ class TextService:
)
new_prompt = f"\n{user_displayname}: {new_prompt} <|endofstatement|>\n"
new_prompt = new_prompt.encode("ascii", "ignore").decode()
#new_prompt = new_prompt.encode("ascii", "ignore").decode()
new_prompt = unidecode.unidecode(new_prompt)
timestamp = int(
str(datetime.datetime.now().timestamp()).replace(".", "")
@ -339,7 +342,8 @@ class TextService:
"\n" + BOT_NAME + str(response_text) + "<|endofstatement|>\n"
)
response_text = response_text.encode("ascii", "ignore").decode()
#response_text = response_text.encode("ascii", "ignore").decode()
response_text = unidecode.unidecode(response_text)
# Print the current timestamp
timestamp = int(

Loading…
Cancel
Save