Skip to content

Commit 2aab5da

Browse files
pylint fixes
1 parent 7f8fac3 commit 2aab5da

File tree

1 file changed

+0
-61
lines changed

1 file changed

+0
-61
lines changed

src/api/services/chat_service.py

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from cachetools import TTLCache
2727

2828
from helpers.utils import format_stream_response
29-
from helpers.azure_openai_helper import get_azure_openai_client
3029
from common.config.config import Config
3130
from agents.chart_agent_factory import ChartAgentFactory
3231

@@ -106,10 +105,6 @@ async def process_rag_response(self, rag_response, query):
106105
content=combined_input
107106
)
108107

109-
print(f"thread with id:{thread.id}",flush=True)
110-
print(f"agent id:{agent.id}",flush=True)
111-
print(f"project clinet :{client}",flush=True)
112-
113108
run = client.agents.runs.create_and_process(
114109
thread_id=thread.id,
115110
agent_id=agent.id
@@ -143,62 +138,6 @@ async def process_rag_response(self, rag_response, query):
143138
logger.error("Agent error in chart generation: %s", e)
144139
return {"error": "Chart could not be generated from this data. Please ask a different question."}
145140

146-
147-
# async def run_agent():
148-
# chart_data = {"error": "Chart could not be generated."}
149-
# try:
150-
# agent_info = await ChartAgentFactory.get_agent()
151-
# agent = agent_info["agent"]
152-
# client = agent_info["client"]
153-
154-
# thread = client.agents.threads.create()
155-
# client.agents.messages.create(
156-
# thread_id=thread.id,
157-
# role=MessageRole.USER,
158-
# content=combined_input
159-
# )
160-
161-
# print(f"thread with id:{thread.id}",flush=True)
162-
# print(f"agent id:{agent.id}",flush=True)
163-
# print(f"project clinet :{client}",flush=True)
164-
165-
# run = client.agents.runs.create_and_process(
166-
# thread_id=thread.id,
167-
# agent_id=agent.id
168-
# )
169-
170-
# if run.status == "failed":
171-
# print(f"[Chart Agent] Run failed: {run.last_error}")
172-
# return {"error": "Chart could not be generated due to agent failure."}
173-
174-
# chart_json = ""
175-
# messages = client.agents.messages.list(thread_id=thread.id, order=ListSortOrder.ASCENDING)
176-
# for msg in messages:
177-
# if msg.role == MessageRole.AGENT and msg.text_messages:
178-
# chart_json = msg.text_messages[-1].text.value.strip()
179-
# break
180-
181-
# chart_json = chart_json.replace("```json", "").replace("```", "").strip()
182-
# client.agents.threads.delete(thread_id=thread.id)
183-
184-
# chart_data = json.loads(chart_json)
185-
# except Exception as e:
186-
# print(f"[Chart Agent Error]: {e}")
187-
# return chart_data
188-
189-
# # Run the async agent call synchronously
190-
# loop = asyncio.get_event_loop()
191-
# chart_data = loop.run_until_complete(run_agent())
192-
193-
# if not chart_data or "error" in chart_data:
194-
# return {"error": "Chart could not be generated from this data. Please ask a different question."}
195-
196-
# return chart_data
197-
198-
# except Exception as e:
199-
# logger.error("Agent error in chart generation: %s", e)
200-
# return {"error": "Chart could not be generated from this data. Please ask a different question."}
201-
202141
async def stream_openai_text(self, conversation_id: str, query: str) -> StreamingResponse:
203142
"""
204143
Get a streaming text response from OpenAI.

0 commit comments

Comments
 (0)