Closed Fleurxxx closed 3 weeks ago
The changes to the AiChat
service in app/service/app-center/aiChat.ts
introduce new functionality for file uploads and processing via the OpenAI API. A new OpenAI
client is established with necessary configurations, and a ConfigModel
interface is defined to manage chat configurations. Two new methods, getFileContentFromAi
and requestFileContentFromAi
, are added to facilitate file handling, including uploading, processing, and error management. The AiChatController
now includes an uploadFile
method to handle file uploads, and a new route is added to support this functionality. Configuration methods for file handling are also introduced.
File Path | Change Summary |
---|---|
app/service/app-center/aiChat.ts | - Added interface: ConfigModel |
- Added method: async getFileContentFromAi(fileStream: any, chatConfig: ConfigModel) |
|
- Added method: async requestFileContentFromAi(file: any, chatConfig: ConfigModel) |
|
- Updated method: async getAnswerFromAi(messages: Array<AiMessage>, chatConfig: any) |
|
- Added method: private extractSchemaCode(content) |
|
app/controller/app-center/aiChat.ts | - Added method: public async uploadFile() for handling file uploads |
app/router/appCenter/base.ts | - New route added: subRouter.post('/ai/files', controller.appCenter.aiChat.uploadFile); |
config/config.default.ts | - Added method: config.uploadFile(file: any, token: string) |
- Added method: config.parsingFile(fileId: any, token: string) |
|
package.json | - Dependency added: "openai": "^4.68.4" in dependencies section |
getFileContentFromAi
and requestFileContentFromAi
) and introduce the same interface (ConfigModel
) in the AiChat
service, indicating a strong connection to the main PR's functionality related to file uploads and processing.In the land of code where rabbits play,
New features hop in, brightening the day.
With files to share and AI to chat,
Our service grows, imagine that!
So let’s celebrate with a joyful cheer,
For every change brings us near! 🐰✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
New Features
Bug Fixes