Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
chatbot_order
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
chatbot_order
Commits
ec2525d2
Commit
ec2525d2
authored
Jan 15, 2026
by
Vũ Hoàng Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update latest code
parent
c30f3c78
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
controller.py
backend/agent/controller.py
+8
-2
No files found.
backend/agent/controller.py
View file @
ec2525d2
...
@@ -16,6 +16,7 @@ from common.conversation_manager import ConversationManager, get_conversation_ma
...
@@ -16,6 +16,7 @@ from common.conversation_manager import ConversationManager, get_conversation_ma
from
common.langfuse_client
import
get_callback_handler
from
common.langfuse_client
import
get_callback_handler
from
common.llm_factory
import
create_llm
from
common.llm_factory
import
create_llm
from
config
import
DEFAULT_MODEL
from
config
import
DEFAULT_MODEL
from
langfuse
import
propagate_attributes
from
.graph
import
build_graph
from
.graph
import
build_graph
from
.models
import
AgentState
,
get_config
from
.models
import
AgentState
,
get_config
...
@@ -110,8 +111,13 @@ async def chat_controller(
...
@@ -110,8 +111,13 @@ async def chat_controller(
callbacks
=
[
langfuse_handler
]
if
langfuse_handler
else
[],
callbacks
=
[
langfuse_handler
]
if
langfuse_handler
else
[],
)
)
# Execute graph
# Execute graph với Langfuse user tracking
# Dùng propagate_attributes để tự động gán user_id cho tất cả observations
start_time
=
time
.
time
()
start_time
=
time
.
time
()
# Generate session_id từ user_id + run_id (có thể thay bằng conversation_id nếu có)
session_id
=
f
"{user_id}-{run_id[:8]}"
with
propagate_attributes
(
user_id
=
user_id
,
session_id
=
session_id
):
result
=
await
graph
.
ainvoke
(
initial_state
,
config
=
exec_config
)
result
=
await
graph
.
ainvoke
(
initial_state
,
config
=
exec_config
)
duration
=
time
.
time
()
-
start_time
duration
=
time
.
time
()
-
start_time
...
...
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