Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /li-boxuan_OpenDevin /openhands /server /data_models /feedback.py
| # IMPORTANT: LEGACY V0 CODE | |
| # This file is part of the legacy (V0) implementation of OpenHands and will be removed soon as we complete the migration to V1. | |
| # OpenHands V1 uses the Software Agent SDK for the agentic core and runs a new application server. Please refer to: | |
| # - V1 agentic core (SDK): https://github.com/OpenHands/software-agent-sdk | |
| # - V1 application server (in this repo): openhands/app_server/ | |
| # Unless you are working on deprecation, please avoid extending this legacy file and consult the V1 codepaths above. | |
| # Tag: Legacy-V0 | |
| # This module belongs to the old V0 web server. The V1 application server lives under openhands/app_server/. | |
| import json | |
| from typing import Any, Literal | |
| import httpx | |
| from pydantic import BaseModel | |
| from openhands.core.logger import openhands_logger as logger | |
| class FeedbackDataModel(BaseModel): | |
| version: str | |
| email: str | |
| polarity: Literal['positive', 'negative'] | |
| feedback: Literal[ | |
| 'positive', 'negative' | |
| ] # TODO: remove this, its here for backward compatibility | |
| permissions: Literal['public', 'private'] | |
| trajectory: list[dict[str, Any]] | None | |
| FEEDBACK_URL = 'https://share-od-trajectory-3u9bw9tx.uc.gateway.dev/share_od_trajectory' | |
| def store_feedback(feedback: FeedbackDataModel) -> dict[str, str]: | |
| # Start logging | |
| feedback.feedback = feedback.polarity | |
| display_feedback = feedback.model_dump() | |
| if 'trajectory' in display_feedback: | |
| display_feedback['trajectory'] = ( | |
| f'elided [length: {len(display_feedback["trajectory"])}' | |
| ) | |
| if 'token' in display_feedback: | |
| display_feedback['token'] = 'elided' | |
| logger.debug(f'Got feedback: {display_feedback}') | |
| # Start actual request | |
| response = httpx.post( | |
| FEEDBACK_URL, | |
| headers={'Content-Type': 'application/json'}, | |
| json=feedback.model_dump(), | |
| ) | |
| if response.status_code != 200: | |
| raise ValueError(f'Failed to store feedback: {response.text}') | |
| response_data: dict[str, str] = json.loads(response.text) | |
| logger.debug(f'Stored feedback: {response.text}') | |
| return response_data | |
Xet Storage Details
- Size:
- 2.12 kB
- Xet hash:
- 3b77d1cf06f30c52af2e3436cb10012b17548e6912976fe74dfdfefaadcf28a4
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.