Spaces:
Running
Running
| from ask_candid.base.api_base import BaseAPI | |
| from ask_candid.base.config.rest import Api, _load_value | |
| ASSISTANT_API = Api( | |
| url=_load_value("ASSISTANT_API_URL"), | |
| key=_load_value("ASSISTANT_API_KEY") | |
| ) | |
| class FeedbackApi(BaseAPI): | |
| def __init__(self): | |
| super().__init__( | |
| url=f"{ASSISTANT_API['url']}/feedback", | |
| headers={"x-api-key": ASSISTANT_API["key"]} | |
| ) | |
| def __call__(self, context, found_helpful, will_recommend, comments, email): | |
| data = { | |
| "context": context, | |
| "found_helpful": found_helpful, | |
| "will_recommend": will_recommend, | |
| "comments": comments, | |
| "email": email | |
| } | |
| result = self.post(payload=data) | |
| return result | |