mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-12-25 14:37:45 -06:00
fix: Fix filtering by user_id for vertex ai session service listing
When the user id contains special characters (i.e. an email), we have added in extra url parsing to address those characters. We have also added an if statement to use the correct url when there is no user_id supplied. Copybara import of the project: -- ef8499001afaea40bd037c4e9946b883e23a5854 by Danny Park <dpark@calicolabs.com>: -- 773cd2b50d15b9b056b47b6155df492b0ca8034c by Danny Park <dpark@calicolabs.com>: COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/996 from dpark27:fix/list_vertex_ai_sessions d351d7f6017c03165129adc7d0212f21d1340d88 PiperOrigin-RevId: 764522026
This commit is contained in:
committed by
Copybara-Service
parent
fc3e374c86
commit
9d4ca4ed44
@@ -16,8 +16,10 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import logging
|
||||
import re
|
||||
import time
|
||||
from typing import Any
|
||||
from typing import Optional
|
||||
import urllib.parse
|
||||
|
||||
from dateutil import parser
|
||||
from google.genai import types
|
||||
@@ -186,10 +188,15 @@ class VertexAiSessionService(BaseSessionService):
|
||||
) -> ListSessionsResponse:
|
||||
reasoning_engine_id = _parse_reasoning_engine_id(app_name)
|
||||
|
||||
path = f"reasoningEngines/{reasoning_engine_id}/sessions"
|
||||
if user_id:
|
||||
parsed_user_id = urllib.parse.quote(f'''"{user_id}"''', safe="")
|
||||
path = path + f"?filter=user_id={parsed_user_id}"
|
||||
|
||||
api_client = _get_api_client(self.project, self.location)
|
||||
api_response = await api_client.async_request(
|
||||
http_method='GET',
|
||||
path=f'reasoningEngines/{reasoning_engine_id}/sessions?filter=user_id={user_id}',
|
||||
path=path,
|
||||
request_dict={},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user