Spaces:
Running
Running
| """ | |
| src/graph/state.py | |
| AgentState ๋ฐ ERPAction TypedDict ์ ์ | |
| """ | |
| import operator | |
| from typing import Annotated, TypedDict, Literal, Optional, List, Any | |
| class ERPAction(TypedDict): | |
| """ERP ์์ ์์ฒญ ํ๋ผ๋ฏธํฐ""" | |
| order_id: str # ์์ ์ค๋ ๋ฒํธ (VBELN, 10์๋ฆฌ) | |
| item_no: str # ์์ดํ ๋ฒํธ (POSNR, 6์๋ฆฌ) | |
| field: str # ๋ณ๊ฒฝ ํ๋ (์: KWMENG, EDATU) | |
| new_value: Any # ๋ณ๊ฒฝ ๊ฐ | |
| reason: str # ๋ณ๊ฒฝ ์ฌ์ | |
| class AgentState(TypedDict): | |
| """LangGraph ๊ทธ๋ํ ์ ์ฒด๊ฐ ๊ณต์ ํ๋ ์ํ ๊ฐ์ฒด""" | |
| # ์ ๋ ฅ | |
| user_input: str | |
| # ์ ์ฒ๋ฆฌ ๊ฒฐ๊ณผ (LangGraph ์ง์ ์ entry point์์ ์ฑ์์ง) | |
| # ์์ฐ์ด ์ด๋ฉ์ผ์ ๊ตฌ์กฐํํ EmailContext์ .model_dump() ๊ฒฐ๊ณผ โ ๋ค์ ํ๋ ํฌํจ: | |
| # sender_name / sender_email / sender_company / recipient / subject / language | |
| # cleaned_body / request_summary / question_summary | |
| # mentions_action / mentions_question | |
| # order_ids / item_nos | |
| # preprocess_ok / error | |
| # ์์ผ๋ฉด(None) ๋ค์ด์คํธ๋ฆผ ๋ ธ๋๋ ์๋ณธ user_input์ ์ง์ ํ์ฑํ๋ ๊ธฐ์กด ๋์์ผ๋ก ํด๋ฐฑ. | |
| email_context: Optional[dict] | |
| # ๋ผ์ฐํฐ ์ถ๋ ฅ | |
| intent: Optional[Literal["ACTION_ONLY", "QA_ONLY", "BOTH"]] | |
| # Worker A | |
| erp_action: Optional[ERPAction] | |
| erp_validation_result: Optional[dict] | |
| erp_action_status: Optional[str] # PENDING_APPROVAL / BLOCKED_* / SUCCESS / REJECTED | |
| odata_response: Optional[dict] | |
| rejection_reason: Optional[str] # ์น์ธ์๊ฐ Slack์์ ์ ๋ ฅํ ๊ฑฐ์ ์ฌ์ (REJECTED ์) | |
| # Worker B | |
| rag_query: Optional[str] | |
| rag_queries: Optional[List[str]] | |
| retrieved_docs: Optional[List[dict]] | |
| rag_answer: Optional[str] | |
| # ์ต์ข ์ถ๋ ฅ | |
| final_response: Optional[str] | |
| # ๋ฉํ | |
| error_messages: Annotated[List[str], operator.add] | |
| requires_human_approval: bool | |
| human_approved: Optional[bool] | |