MCPcopy Create free account
hub / github.com/OpenCodeInterpreter/OpenCodeInterpreter / convert_history

Function convert_history

demo/chatbot.py:87–96  ·  view source on GitHub ↗
(gradio_history: list[list], interpreter_history: list[dict])

Source from the content-addressed store, hash-verified

85 f.write("\n")
86
87def convert_history(gradio_history: list[list], interpreter_history: list[dict]):
88 interpreter_history = [interpreter_history[0]] if interpreter_history and interpreter_history[0]["role"] == "system" else []
89 if not gradio_history:
90 return interpreter_history
91 for item in gradio_history:
92 if item[0] is not None:
93 interpreter_history.append({"role": "user", "content": item[0]})
94 if item[1] is not None:
95 interpreter_history.append({"role": "assistant", "content": item[1]})
96 return interpreter_history
97
98def update_uuid(dialog_info):
99 new_uuid = str(uuid4())

Callers 1

botFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected