fix: Add return type hint -> str to chat endpoint to prevent UserWarning and enable client data reception
Browse files
app.py
CHANGED
|
@@ -18,7 +18,7 @@ async def get_hf_token_status():
|
|
| 18 |
return {"has_token": token_exists}
|
| 19 |
|
| 20 |
@app.api(name="chat")
|
| 21 |
-
async def chat(messages_json: str, temperature: float = 0.7, max_tokens: int = 1024, custom_token: str = None):
|
| 22 |
# Check for Hugging Face token: custom override or environment variable
|
| 23 |
hf_token = (custom_token and custom_token.strip()) or os.environ.get("HF_TOKEN")
|
| 24 |
|
|
|
|
| 18 |
return {"has_token": token_exists}
|
| 19 |
|
| 20 |
@app.api(name="chat")
|
| 21 |
+
async def chat(messages_json: str, temperature: float = 0.7, max_tokens: int = 1024, custom_token: str = None) -> str:
|
| 22 |
# Check for Hugging Face token: custom override or environment variable
|
| 23 |
hf_token = (custom_token and custom_token.strip()) or os.environ.get("HF_TOKEN")
|
| 24 |
|