Spaces:
Runtime error
Runtime error
File size: 726 Bytes
888ca1a 8987ddb 888ca1a 6306cd3 888ca1a 6c496de 888ca1a 6c496de 888ca1a 6c496de 888ca1a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
from langgraph.graph import StateGraph, END
from langchain_core.runnables import Runnable
from langchain_core.messages import HumanMessage, AIMessage
# عقدة ترد على المستخدم
def reply_node(state: dict) -> dict:
user_msg = state["messages"][-1].content
return {"messages": state["messages"] + [AIMessage(content=f"🤖 Agent Response: {user_msg}")]} # الرد بسيط
def ninu() -> Runnable:
graph = StateGraph()
# نحدد الحالة الابتدائية
graph.add_node("reply", reply_node)
# نحدد البداية والنهاية
graph.set_entry_point("reply")
graph.add_edge("reply", END)
# نبني النموذج النهائي
return graph.compile()
|