Skip to content

Commit 294744f

Browse files
committed
add platform_medium field to Conversation model
1 parent b06798e commit 294744f

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Generated by Django 5.1.3 on 2025-06-18 09:58
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("bots", "0103_alter_botintegration_public_visibility"),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name="conversation",
15+
name="platform_medium",
16+
field=models.TextField(
17+
blank=True, default="", help_text="Platform medium Voice / SMS"
18+
),
19+
),
20+
]

bots/models/convo_msg.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ class Conversation(models.Model):
238238
help_text="Twilio call sid (only used if each call is a new conversation)",
239239
)
240240

241+
platform_medium = models.TextField(
242+
blank=True,
243+
default="",
244+
help_text="Platform medium Voice / SMS ",
245+
)
246+
241247
web_user_id = models.CharField(
242248
max_length=512,
243249
blank=True,

daras_ai_v2/bots.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,8 @@ def build_system_vars(convo: Conversation, user_msg_id: str) -> tuple[dict, dict
589589
variables["bot_twilio_phone_number"] = (
590590
bi.twilio_phone_number and bi.twilio_phone_number.as_international
591591
)
592+
variables["platform_medium"] = convo.platform_medium
593+
592594
variables_schema = {var: {"role": "system"} for var in variables}
593595
return variables, variables_schema
594596

daras_ai_v2/twilio_bot.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def __init__(self, data: dict):
2929
bot_integration=bi,
3030
twilio_phone_number=data["From"][0],
3131
twilio_call_sid="",
32+
platform_medium="SMS",
3233
)[0]
3334

3435
self.bot_id = bi.twilio_phone_number.as_e164
@@ -175,6 +176,7 @@ def __init__(
175176
audio_url: str = None,
176177
):
177178
self.convo = convo
179+
convo.platform_medium = "Voice"
178180

179181
self.bot_id = convo.bot_integration.twilio_phone_number.as_e164
180182
self.user_id = convo.twilio_phone_number.as_e164

0 commit comments

Comments
 (0)