Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files
app.py
CHANGED
|
@@ -161,9 +161,6 @@ async def honeypot_detection(
|
|
| 161 |
) -> Dict[str, Any]:
|
| 162 |
session_id = request_data.sessionId
|
| 163 |
config = {"configurable": {"thread_id": session_id}}
|
| 164 |
-
|
| 165 |
-
raw_history = request_data.conversationHistory
|
| 166 |
-
normalized_history = _normalize_history(raw_history)
|
| 167 |
|
| 168 |
checkpoint = honeypot_app.get_state(config)
|
| 169 |
start_time = time.time()
|
|
@@ -182,7 +179,7 @@ async def honeypot_detection(
|
|
| 182 |
current_state["totalMessagesExchanged"] += 1
|
| 183 |
input_state = current_state
|
| 184 |
else:
|
| 185 |
-
initial_history =
|
| 186 |
input_state = AgentState(
|
| 187 |
sessionId=session_id,
|
| 188 |
conversationHistory=initial_history,
|
|
|
|
| 161 |
) -> Dict[str, Any]:
|
| 162 |
session_id = request_data.sessionId
|
| 163 |
config = {"configurable": {"thread_id": session_id}}
|
|
|
|
|
|
|
|
|
|
| 164 |
|
| 165 |
checkpoint = honeypot_app.get_state(config)
|
| 166 |
start_time = time.time()
|
|
|
|
| 179 |
current_state["totalMessagesExchanged"] += 1
|
| 180 |
input_state = current_state
|
| 181 |
else:
|
| 182 |
+
initial_history = request_data.conversationHistory + [request_data.message]
|
| 183 |
input_state = AgentState(
|
| 184 |
sessionId=session_id,
|
| 185 |
conversationHistory=initial_history,
|
models.py
CHANGED
|
@@ -21,7 +21,7 @@ class HoneypotRequest(BaseModel):
|
|
| 21 |
"""The incoming request body for the honeypot API."""
|
| 22 |
sessionId: str = Field(..., description="Unique session ID")
|
| 23 |
message: Message = Field(..., description="The latest incoming message")
|
| 24 |
-
conversationHistory:
|
| 25 |
metadata: Optional[Metadata] = None
|
| 26 |
|
| 27 |
class ExtractedIntelligence(BaseModel):
|
|
|
|
| 21 |
"""The incoming request body for the honeypot API."""
|
| 22 |
sessionId: str = Field(..., description="Unique session ID")
|
| 23 |
message: Message = Field(..., description="The latest incoming message")
|
| 24 |
+
conversationHistory: List[Message] = Field(default_factory=list, description="All previous messages")
|
| 25 |
metadata: Optional[Metadata] = None
|
| 26 |
|
| 27 |
class ExtractedIntelligence(BaseModel):
|