MCPcopy Index your code
hub / github.com/dataease/SQLBot / save_chart

Function save_chart

backend/apps/chat/curd/chat.py:1048–1065  ·  view source on GitHub ↗
(session: SessionDep, record_id: int, chart: str)

Source from the content-addressed store, hash-verified

1046
1047
1048def save_chart(session: SessionDep, record_id: int, chart: str) -> ChatRecord:
1049 if not record_id:
1050 raise Exception("Record id cannot be None")
1051 record = get_chat_record_by_id(session, record_id)
1052
1053 record.chart = chart
1054
1055 result = ChatRecord(**record.model_dump())
1056
1057 stmt = update(ChatRecord).where(and_(ChatRecord.id == record.id)).values(
1058 chart=record.chart
1059 )
1060
1061 session.execute(stmt)
1062
1063 session.commit()
1064
1065 return result
1066
1067
1068def save_predict_data(session: SessionDep, record_id: int, data: str = '') -> ChatRecord:

Callers 1

check_save_chartMethod · 0.90

Calls 4

ChatRecordClass · 0.90
get_chat_record_by_idFunction · 0.85
updateFunction · 0.50
valuesMethod · 0.45

Tested by

no test coverage detected