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: 4 additions & 0 deletions backend/routers/pusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ async def send_heartbeat():
audio_bytes_webhook_delay_seconds = get_audio_bytes_webhook_seconds(uid)
audio_bytes_trigger_delay_seconds = 5
has_audio_apps_enabled = is_audio_bytes_app_enabled(uid)
print("has_audio_apps_enabled", has_audio_apps_enabled, uid)

# task
async def receive_audio_bytes():
Expand All @@ -77,8 +78,11 @@ async def receive_audio_bytes():
res = json.loads(bytes(data[4:]).decode("utf-8"))
segments = res.get('segments')
memory_id = res.get('memory_id')
print("received transcripts", uid)
asyncio.run_coroutine_threadsafe(trigger_realtime_integrations(uid, segments, memory_id), loop)
print("received transcripts cp2", uid)
asyncio.run_coroutine_threadsafe(realtime_transcript_webhook(uid, segments), loop)
print("received transcripts cp3", uid)
continue

# Audio bytes
Expand Down
11 changes: 9 additions & 2 deletions backend/utils/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,34 +70,41 @@ def weighted_rating(plugin):


def get_available_apps(uid: str, include_reviews: bool = False) -> List[App]:
print('get_available_apps 0', uid)
private_data = []
public_approved_data = []
public_unapproved_data = []
tester_apps = []
all_apps = []
tester = is_tester(uid)
if cachedApps := get_generic_cache('get_public_approved_apps_data'):
print('get_available_apps 1', uid)
print('get_public_approved_plugins_data from cache----------------------------')
public_approved_data = cachedApps
public_approved_data = get_public_approved_apps_db()
public_unapproved_data = get_public_unapproved_apps(uid)
private_data = get_private_apps(uid)
pass
else:
print('get_available_apps 2', uid)
print('get_public_approved_plugins_data from db----------------------------')
private_data = get_private_apps(uid)
public_approved_data = get_public_approved_apps_db()
public_unapproved_data = get_public_unapproved_apps(uid)
set_generic_cache('get_public_approved_apps_data', public_approved_data, 60 * 10) # 10 minutes cached
if tester:
print('get_available_apps 3', uid)
tester_apps = get_apps_for_tester_db(uid)
print('get_available_apps 4', uid)
user_enabled = set(get_enabled_plugins(uid))
print('get_available_apps 5', uid)
all_apps = private_data + public_approved_data + public_unapproved_data + tester_apps
apps = []

app_ids = [app['id'] for app in all_apps]
plugins_install = get_plugins_installs_count(app_ids)
plugins_review = get_plugins_reviews(app_ids) if include_reviews else {}
print('get_available_apps 5', uid)

for app in all_apps:
app_dict = app
Expand Down Expand Up @@ -602,10 +609,10 @@ def app_has_action(app: dict, action_name: str) -> bool:
"""Check if an app has a specific action capability."""
if not app.get('external_integration'):
return False

actions = app['external_integration'].get('actions', [])
for action in actions:
if action.get('action') == action_name:
return True

return False