Business Logic
loglife.app.logic.text.processor
Message processing logic for inbound WhatsApp text commands.
process_text(user, message)
Route incoming text commands to the appropriate goal or rating handler.
Handle commands such as adding goals, submitting ratings, configuring reminder times, and generating look-back summaries. Maintain temporary state for multi-step flows (e.g., goal reminder setup).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user
|
User
|
The user record for the message sender |
required |
message
|
Message
|
The incoming message object |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The WhatsApp response text to send back to the user. |
Source code in src/loglife/app/logic/text/processor.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
loglife.app.logic.audio.processor
Audio processing workflow for inbound WhatsApp messages.
Orchestrates transcription (Whisper), summarization (GPT), and database storage of voice notes.
process_audio(user, message)
Process an incoming audio message from a user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user
|
User
|
The user record dictionary |
required |
message
|
Message
|
The incoming message object |
required |
Returns:
| Type | Description |
|---|---|
str | tuple[str, str]
|
The summarized text generated from the audio, or a tuple of |
str | tuple[str, str]
|
(transcript_file_base64, summarized_text). |
Source code in src/loglife/app/logic/audio/processor.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
loglife.app.logic.vcard.processor
Processing logic for referral VCARD payloads.
process_vcard(referrer_user, message)
Create referral users from VCARD attachments.
Parse the incoming VCARD JSON payload, ensure each contact exists as a user, link referrals, and send a welcome message to each referred number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
referrer_user
|
User
|
The user dict of the person sharing the VCARDs |
required |
message
|
Message
|
The incoming message object |
required |
Returns:
| Type | Description |
|---|---|
str
|
The referral success message constant. |
Source code in src/loglife/app/logic/vcard/processor.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |