Update app.py
Browse files
app.py
CHANGED
|
@@ -42,7 +42,7 @@ class RefToken(BaseModel):
|
|
| 42 |
ref_key: str
|
| 43 |
|
| 44 |
@app.get("/")
|
| 45 |
-
async def
|
| 46 |
try:
|
| 47 |
return {
|
| 48 |
"Please Check the documentation here": "https://huggingface.co/spaces/Subhraj07/chatapi/blob/main/README.md",
|
|
@@ -70,7 +70,7 @@ async def list(token: str = Depends(verify_token)):
|
|
| 70 |
raise HTTPException(status_code=500, detail="An error occurred while processing the request." + str(e))
|
| 71 |
|
| 72 |
@app.post("/chat")
|
| 73 |
-
async def
|
| 74 |
openai.api_key = chat_input.openAI_token
|
| 75 |
prompt = f"User: {chat_input.message}\nAI:"
|
| 76 |
model_name = chat_input.model_name
|
|
|
|
| 42 |
ref_key: str
|
| 43 |
|
| 44 |
@app.get("/")
|
| 45 |
+
async def base_url():
|
| 46 |
try:
|
| 47 |
return {
|
| 48 |
"Please Check the documentation here": "https://huggingface.co/spaces/Subhraj07/chatapi/blob/main/README.md",
|
|
|
|
| 70 |
raise HTTPException(status_code=500, detail="An error occurred while processing the request." + str(e))
|
| 71 |
|
| 72 |
@app.post("/chat")
|
| 73 |
+
async def chat(chat_input: ChatInput, token: str = Depends(verify_token)):
|
| 74 |
openai.api_key = chat_input.openAI_token
|
| 75 |
prompt = f"User: {chat_input.message}\nAI:"
|
| 76 |
model_name = chat_input.model_name
|