-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Milestone
Description
Why❓
- 쿼리 실행시 간헐적으로 에러 발생 : AttributeError: 'AIMessage' object has no attribute 'encode'
- 같은 질문을 반복적으로 실행해도 성공과 실패가 랜덤하게 나타남.
How❓
- 디버깅 및 코드 수정
What❓
- 코드 수정
에러내용
2025-04-30 18:27:54.873 Uncaught app execution
Traceback (most recent call last):
File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling
result = func()
^^^^^^
File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 579, in code_to_exec
exec(code, module.__dict__)
File "/Users/pgt0409/Desktop/git/Lang2SQL/interface/streamlit_app.py", line 75, in <module>
st.navigation(pages).run()
File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/streamlit/navigation/page.py", line 303, in run
exec(code, module.__dict__)
File "/Users/pgt0409/Desktop/git/Lang2SQL/interface/lang2sql.py", line 219, in <module>
display_result(res=result, database=db)
File "/Users/pgt0409/Desktop/git/Lang2SQL/interface/lang2sql.py", line 150, in display_result
df = database.run_sql(sql)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/pgt0409/Desktop/git/Lang2SQL/llm_utils/connect_db.py", line 44, in run_sql
raise e
File "/Users/pgt0409/Desktop/git/Lang2SQL/llm_utils/connect_db.py", line 34, in run_sql
result = self.client.execute(sql, with_column_types=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/clickhouse_driver/client.py", line 382, in execute
rv = self.process_ordinary_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/clickhouse_driver/client.py", line 577, in process_ordinary_query
self.connection.send_query(query, query_id=query_id, params=params)
File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/clickhouse_driver/connection.py", line 723, in send_query
write_binary_str(query, self.fout)
File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/clickhouse_driver/writer.py", line 15, in write_binary_str
text = text.encode('utf-8')
^^^^^^^^^^^
File "/Users/pgt0409/opt/anaconda3/envs/lang2sql/lib/python3.12/site-packages/pydantic/main.py", line 891, in __getattr__
raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')
AttributeError: 'AIMessage' object has no attribute 'encode'
Metadata
Metadata
Assignees
Labels
No labels