forked from microsoft/semantic-kernel
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AI interaction capability to the web interface. * **AgentDocs/AssistantFileSearch/Program.cs** - Add `HandleAIInteraction` method to handle AI interactions via a web interface. - Integrate the method with the existing logic and use `OpenAIAssistantAgent` for AI communication. * **app.py** - Add an endpoint `/ai-interact` to interact with the AI using the method from `AgentDocs/AssistantFileSearch/Program.cs`. - Ensure the endpoint handles POST requests and returns AI responses in JSON format. * **config.json** - Add configuration settings for AI interaction, such as API keys and endpoints.
- Loading branch information
Showing
3 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
|
||
from fastapi import FastAPI | ||
from fastapi import FastAPI, Request | ||
from pydantic import BaseModel | ||
import asyncio | ||
import AgentDocs.AssistantFileSearch.Program as assistant | ||
|
||
app = FastAPI() | ||
|
||
class AIRequest(BaseModel): | ||
user_input: str | ||
|
||
@app.get("/") | ||
def greet_json(): | ||
return {"Hello": "World!"} | ||
|
||
@app.post("/ai-interact") | ||
async def ai_interact(request: Request, ai_request: AIRequest): | ||
user_input = ai_request.user_input | ||
response = await assistant.HandleAIInteraction(user_input) | ||
return {"response": response} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters