Skip to content

Commit b06798e

Browse files
authored
Merge pull request #699 from GooeyAI/deafult_widget
use bot branding from web integration when available
2 parents fb1cc17 + 687e692 commit b06798e

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed

bots/models/bot_integration.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -518,17 +518,7 @@ def get_web_widget_config(
518518
config = self.web_config_extras | dict(
519519
target=target,
520520
integration_id=self.api_integration_id(),
521-
branding=(
522-
self.web_config_extras.get("branding", {})
523-
| dict(
524-
name=self.name,
525-
byLine=self.by_line,
526-
description=self.descripton,
527-
conversationStarters=self.conversation_starters,
528-
photoUrl=self.photo_url,
529-
websiteUrl=self.website_url,
530-
)
531-
),
521+
branding=self.get_web_widget_branding(),
532522
)
533523

534524
google_maps_api_key = None
@@ -551,6 +541,16 @@ def get_web_widget_config(
551541
config["apiUrl"] = get_api_route_url(stream_create)
552542
return config
553543

544+
def get_web_widget_branding(self) -> dict:
545+
return self.web_config_extras.get("branding", {}) | dict(
546+
name=self.name,
547+
byLine=self.by_line,
548+
description=self.descripton,
549+
conversationStarters=self.conversation_starters,
550+
photoUrl=self.photo_url,
551+
websiteUrl=self.website_url,
552+
)
553+
554554
def translate(self, text: str) -> str:
555555
from daras_ai_v2.asr import run_google_translate, should_translate_lang
556556

recipes/VideoBots.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,24 @@ def render_output(self):
797797
)
798798
)
799799

800+
# fill branding with bot integration data if available
801+
bot_integration = (
802+
BotIntegration.objects.filter(
803+
published_run=self.current_pr,
804+
platform=Platform.WEB,
805+
)
806+
.order_by("-updated_at")
807+
.first()
808+
)
809+
if bot_integration:
810+
bot_branding = bot_integration.get_web_widget_branding()
811+
else:
812+
bot_branding = dict(
813+
name=self.current_pr.title,
814+
photoUrl=self.current_pr.photo_url,
815+
title=self.current_pr.title,
816+
)
817+
bot_branding["showPoweredByGooey"] = False
800818
gui.html(
801819
# language=html
802820
f"""
@@ -846,12 +864,7 @@ def render_output(self):
846864
enableAudioMessage=True,
847865
enablePhotoUpload=True,
848866
enableConversations=False,
849-
branding=dict(
850-
name=self.current_pr.title,
851-
photoUrl=self.current_pr.photo_url,
852-
title="Preview",
853-
showPoweredByGooey=False,
854-
),
867+
branding=bot_branding,
855868
fillParent=True,
856869
secrets=dict(GOOGLE_MAPS_API_KEY=settings.GOOGLE_MAPS_API_KEY),
857870
),

0 commit comments

Comments
 (0)