Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ai company
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
ai company
Commits
ba18ff5a
Commit
ba18ff5a
authored
May 04, 2026
by
Vũ Hoàng Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: handle None created_at in lead_flow_postgres to prevent isoformat AttributeError
parent
41fbe225
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
lead_flow_postgres.py
backend/common/lead_flow_postgres.py
+8
-8
No files found.
backend/common/lead_flow_postgres.py
View file @
ba18ff5a
...
@@ -169,7 +169,7 @@ async def get_lead_history(
...
@@ -169,7 +169,7 @@ async def get_lead_history(
"id"
:
r
[
"id"
],
"id"
:
r
[
"id"
],
"is_human"
:
r
[
"is_human"
],
"is_human"
:
r
[
"is_human"
],
"message"
:
r
[
"message"
],
"message"
:
r
[
"message"
],
"timestamp"
:
r
[
"created_at"
]
if
isinstance
(
r
[
"created_at"
],
str
)
else
r
[
"created_at"
]
.
isoformat
()
,
"timestamp"
:
(
r
[
"created_at"
]
if
isinstance
(
r
[
"created_at"
],
str
)
else
r
[
"created_at"
]
.
isoformat
())
if
r
[
"created_at"
]
else
""
,
"conversation_id"
:
conv_id
,
"conversation_id"
:
conv_id
,
}
}
for
r
in
rows
for
r
in
rows
...
@@ -199,7 +199,7 @@ async def get_lead_history(
...
@@ -199,7 +199,7 @@ async def get_lead_history(
"id"
:
r
[
"id"
],
"id"
:
r
[
"id"
],
"is_human"
:
r
[
"is_human"
],
"is_human"
:
r
[
"is_human"
],
"message"
:
r
[
"message"
],
"message"
:
r
[
"message"
],
"timestamp"
:
r
[
"created_at"
]
.
isoformat
(),
"timestamp"
:
r
[
"created_at"
]
.
isoformat
()
if
r
[
"created_at"
]
else
""
,
"conversation_id"
:
conv_id
,
"conversation_id"
:
conv_id
,
}
}
for
r
in
rows
for
r
in
rows
...
@@ -238,8 +238,8 @@ async def list_lead_conversations(device_id: str, limit: int = 20) -> list[dict]
...
@@ -238,8 +238,8 @@ async def list_lead_conversations(device_id: str, limit: int = 20) -> list[dict]
return
[
return
[
{
{
"conv_id"
:
r
[
"conv_id"
],
"conv_id"
:
r
[
"conv_id"
],
"started_at"
:
r
[
"started_at"
]
if
isinstance
(
r
[
"started_at"
],
str
)
else
r
[
"started_at"
]
.
isoformat
()
,
"started_at"
:
(
r
[
"started_at"
]
if
isinstance
(
r
[
"started_at"
],
str
)
else
r
[
"started_at"
]
.
isoformat
())
if
r
[
"started_at"
]
else
""
,
"last_at"
:
r
[
"last_at"
]
if
isinstance
(
r
[
"last_at"
],
str
)
else
r
[
"last_at"
]
.
isoformat
()
,
"last_at"
:
(
r
[
"last_at"
]
if
isinstance
(
r
[
"last_at"
],
str
)
else
r
[
"last_at"
]
.
isoformat
())
if
r
[
"last_at"
]
else
""
,
"turn_count"
:
r
[
"turn_count"
],
"turn_count"
:
r
[
"turn_count"
],
}
}
for
r
in
rows
for
r
in
rows
...
@@ -271,8 +271,8 @@ async def list_lead_conversations(device_id: str, limit: int = 20) -> list[dict]
...
@@ -271,8 +271,8 @@ async def list_lead_conversations(device_id: str, limit: int = 20) -> list[dict]
return
[
return
[
{
{
"conv_id"
:
r
[
"conv_id"
],
"conv_id"
:
r
[
"conv_id"
],
"started_at"
:
r
[
"started_at"
]
.
isoformat
(),
"started_at"
:
r
[
"started_at"
]
.
isoformat
()
if
r
[
"started_at"
]
else
""
,
"last_at"
:
r
[
"last_at"
]
.
isoformat
(),
"last_at"
:
r
[
"last_at"
]
.
isoformat
()
if
r
[
"last_at"
]
else
""
,
"turn_count"
:
r
[
"turn_count"
],
"turn_count"
:
r
[
"turn_count"
],
}
}
for
r
in
rows
for
r
in
rows
...
@@ -312,7 +312,7 @@ async def get_all_history_for_dashboard(limit: int = 200) -> list[dict]:
...
@@ -312,7 +312,7 @@ async def get_all_history_for_dashboard(limit: int = 200) -> list[dict]:
"ai_response"
:
r
[
"ai_response"
],
"ai_response"
:
r
[
"ai_response"
],
"products"
:
r
[
"products"
],
"products"
:
r
[
"products"
],
"lead_stage"
:
r
[
"lead_stage"
],
"lead_stage"
:
r
[
"lead_stage"
],
"created_at"
:
r
[
"created_at"
]
if
isinstance
(
r
[
"created_at"
],
str
)
else
r
[
"created_at"
]
.
isoformat
()
,
"created_at"
:
(
r
[
"created_at"
]
if
isinstance
(
r
[
"created_at"
],
str
)
else
r
[
"created_at"
]
.
isoformat
())
if
r
[
"created_at"
]
else
""
,
}
}
for
r
in
rows
for
r
in
rows
]
]
...
@@ -346,7 +346,7 @@ async def get_all_history_for_dashboard(limit: int = 200) -> list[dict]:
...
@@ -346,7 +346,7 @@ async def get_all_history_for_dashboard(limit: int = 200) -> list[dict]:
"ai_response"
:
r
[
"ai_response"
],
"ai_response"
:
r
[
"ai_response"
],
"products"
:
r
[
"products"
],
"products"
:
r
[
"products"
],
"lead_stage"
:
r
[
"lead_stage"
],
"lead_stage"
:
r
[
"lead_stage"
],
"created_at"
:
r
[
"created_at"
]
.
isoformat
(),
"created_at"
:
r
[
"created_at"
]
.
isoformat
()
if
r
[
"created_at"
]
else
""
,
}
}
for
r
in
rows
for
r
in
rows
]
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment