Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions echo/server/dembrane/chat_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async def create_system_messages_for_chat(
if conversation.created_at
else None,
"duration": conversation.duration,
"transcript": get_conversation_transcript(
"transcript": await get_conversation_transcript(
conversation.id,
# fake auth to get this fn call
DirectusSession(user_id="none", is_admin=True),
Expand Down Expand Up @@ -427,7 +427,7 @@ async def _process_single_batch(
else:
# Use transcript as fallback
try:
transcript = get_conversation_transcript(
transcript = await get_conversation_transcript(
conv.id,
DirectusSession(user_id="none", is_admin=True),
)
Expand Down
2 changes: 1 addition & 1 deletion echo/server/dembrane/report_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async def get_report_content_for_project(project_id: str, language: str) -> str:
if conversation["id"] not in conversation_data_dict:
continue

transcript = get_conversation_transcript(
transcript = await get_conversation_transcript(
conversation["id"],
DirectusSession(user_id="none", is_admin=True),
)
Expand Down
14 changes: 9 additions & 5 deletions echo/server/tests/api/test_conversation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import logging

import pytest

from tests.common import (
create_project,
delete_project,
Expand All @@ -15,15 +17,16 @@
logger = logging.getLogger("dembrane.tests.api.test_conversation")


def test_get_conversation_transcript():
@pytest.mark.asyncio
async def test_get_conversation_transcript():
project = create_project("test", "en")
conversation = create_conversation(project["id"], "test")
chunks = [
create_conversation_chunk(conversation["id"], "check123"),
create_conversation_chunk(conversation["id"], "check456"),
]

transcript = get_conversation_transcript(
transcript = await get_conversation_transcript(
conversation["id"], auth=DirectusSession(user_id="none", is_admin=True)
)
assert transcript == "check123\ncheck456"
Expand All @@ -35,11 +38,12 @@ def test_get_conversation_transcript():
delete_project(project["id"])


def test_summarize_conversation():
@pytest.mark.asyncio
async def test_summarize_conversation():
project = create_project("test", "en")
conversation = create_conversation(project["id"], "test")

response = summarize_conversation(
response = await summarize_conversation(
conversation["id"], auth=DirectusSession(user_id="none", is_admin=True)
)

Expand All @@ -48,7 +52,7 @@ def test_summarize_conversation():

chunk = create_conversation_chunk(conversation["id"], "Hello, how are you?")

response = summarize_conversation(
response = await summarize_conversation(
conversation["id"], auth=DirectusSession(user_id="none", is_admin=True)
)

Expand Down
Loading