refactor: rewrite OpenAI integration

- use `OpenAI` and `Azure.AI.OpenAI`
- use `developer` role instead of `system` for OpenAI's `o1` series models
- use streaming response
- re-design `AIAssistant`

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2024-12-24 15:51:27 +08:00
parent cf90e51887
commit a915708db3
No known key found for this signature in database
12 changed files with 270 additions and 212 deletions

View file

@ -136,11 +136,11 @@ This software supports using OpenAI or other AI service that has an OpenAI comap
For `OpenAI`:
* `Server` must be `https://api.openai.com/v1/chat/completions`
* `Server` must be `https://api.openai.com/v1`
For other AI service:
* The `Server` should fill in a URL equivalent to OpenAI's `https://api.openai.com/v1/chat/completions`. For example, when using `Ollama`, it should be `http://localhost:11434/v1/chat/completions` instead of `http://localhost:11434/api/generate`
* The `Server` should fill in a URL equivalent to OpenAI's `https://api.openai.com/v1`. For example, when using `Ollama`, it should be `http://localhost:11434/v1` instead of `http://localhost:11434/api/generate`
* The `API Key` is optional that depends on the service
## External Tools