Skip to content

Commit

Permalink
added sorting for utterrances
Browse files Browse the repository at this point in the history
  • Loading branch information
sfahad1414 committed May 13, 2024
1 parent 7ac46e4 commit eeade63
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions kairon/api/app/routers/bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ async def download_model(
model_path,
filename=os.path.basename(model_path),
background=background_tasks,
media_type='application/octet-stream'
)
AuditDataProcessor.log("Model", current_user.account, current_user.get_bot(), current_user.get_user(),
action=AuditlogActions.DOWNLOAD.value)
Expand Down
2 changes: 1 addition & 1 deletion kairon/shared/data/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5355,7 +5355,7 @@ def add_utterance_name(
).save()

def get_utterances(self, bot: Text):
utterances = Utterances.objects(bot=bot, status=True)
utterances = Utterances.objects(bot=bot, status=True).order_by("-timestamp")
for utterance in utterances:
utterance = utterance.to_mongo().to_dict()
utterance["_id"] = utterance["_id"].__str__()
Expand Down
2 changes: 2 additions & 0 deletions kairon/shared/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
from .data.dto import KaironStoryStep
from .models import StoryStepType, LlmPromptType, LlmPromptSource
from ..exceptions import AppException
from werkzeug.utils import secure_filename


class Utility:
Expand Down Expand Up @@ -826,6 +827,7 @@ def copy_pretrained_model(bot: Text, template_name: Text):
output_path = f"models/{bot}"
tempdir = tempfile.mkdtemp()
try:
template_name = secure_filename(template_name)
model_path = f"template/use-cases/{template_name}/models"
if os.path.exists(model_path):
model_file = Utility.get_latest_file(
Expand Down

0 comments on commit eeade63

Please sign in to comment.