-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(assistant): Assistant and AssistantFiles api #1803
Changes from 7 commits
6c89102
00437ae
0b3c84a
d3f9c09
7d182c7
0f1959f
8811c89
3b89a81
cd9a9ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ package http | |
import ( | ||
"encoding/json" | ||
"errors" | ||
"github.com/go-skynet/LocalAI/pkg/utils" | ||
"os" | ||
"strings" | ||
|
||
|
@@ -135,8 +136,17 @@ func App(cl *config.BackendConfigLoader, ml *model.ModelLoader, appConfig *confi | |
}{Version: internal.PrintableVersion()}) | ||
}) | ||
|
||
// Load upload json | ||
openai.LoadUploadConfig(appConfig.UploadDir) | ||
// Make sure directories exists | ||
os.MkdirAll(appConfig.ImageDir, 0755) | ||
os.MkdirAll(appConfig.AudioDir, 0755) | ||
os.MkdirAll(appConfig.UploadDir, 0755) | ||
os.MkdirAll(appConfig.ConfigsDir, 0755) | ||
os.MkdirAll(appConfig.ModelPath, 0755) | ||
|
||
// Load config jsons | ||
utils.LoadConfig(appConfig.UploadDir, openai.UploadedFilesFile, &openai.UploadedFiles) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm currently in the middle of refactoring things such that |
||
utils.LoadConfig(appConfig.ConfigsDir, openai.AssistantsConfigFile, &openai.Assistants) | ||
utils.LoadConfig(appConfig.ConfigsDir, openai.AssistantsFileConfigFile, &openai.AssistantFiles) | ||
|
||
modelGalleryEndpointService := localai.CreateModelGalleryEndpointService(appConfig.Galleries, appConfig.ModelPath, galleryService) | ||
app.Post("/models/apply", auth, modelGalleryEndpointService.ApplyModelGalleryEndpoint()) | ||
|
@@ -157,6 +167,26 @@ func App(cl *config.BackendConfigLoader, ml *model.ModelLoader, appConfig *confi | |
app.Post("/v1/edits", auth, openai.EditEndpoint(cl, ml, appConfig)) | ||
app.Post("/edits", auth, openai.EditEndpoint(cl, ml, appConfig)) | ||
|
||
// assistant | ||
app.Get("/v1/assistants", openai.ListAssistantsEndpoint(cl, ml, appConfig)) | ||
app.Get("/assistants", openai.ListAssistantsEndpoint(cl, ml, appConfig)) | ||
app.Post("/v1/assistants", openai.CreateAssistantEndpoint(cl, ml, appConfig)) | ||
app.Post("/assistants", openai.CreateAssistantEndpoint(cl, ml, appConfig)) | ||
app.Delete("/v1/assistants/:assistant_id", openai.DeleteAssistantEndpoint(cl, ml, appConfig)) | ||
app.Delete("/assistants/:assistant_id", openai.DeleteAssistantEndpoint(cl, ml, appConfig)) | ||
app.Get("/v1/assistants/:assistant_id", openai.GetAssistantEndpoint(cl, ml, appConfig)) | ||
app.Get("/assistants/:assistant_id", openai.GetAssistantEndpoint(cl, ml, appConfig)) | ||
app.Post("/v1/assistants/:assistant_id", openai.ModifyAssistantEndpoint(cl, ml, appConfig)) | ||
app.Post("/assistants/:assistant_id", openai.ModifyAssistantEndpoint(cl, ml, appConfig)) | ||
app.Get("/v1/assistants/:assistant_id/files", openai.ListAssistantFilesEndpoint(cl, ml, appConfig)) | ||
app.Get("/assistants/:assistant_id/files", openai.ListAssistantFilesEndpoint(cl, ml, appConfig)) | ||
app.Post("/v1/assistants/:assistant_id/files", openai.CreateAssistantFileEndpoint(cl, ml, appConfig)) | ||
app.Post("/assistants/:assistant_id/files", openai.CreateAssistantFileEndpoint(cl, ml, appConfig)) | ||
app.Delete("/v1/assistants/:assistant_id/files/:file_id", openai.DeleteAssistantFileEndpoint(cl, ml, appConfig)) | ||
app.Delete("/assistants/:assistant_id/files/:file_id", openai.DeleteAssistantFileEndpoint(cl, ml, appConfig)) | ||
app.Get("/v1/assistants/:assistant_id/files/:file_id", openai.GetAssistantFileEndpoint(cl, ml, appConfig)) | ||
app.Get("/assistants/:assistant_id/files/:file_id", openai.GetAssistantFileEndpoint(cl, ml, appConfig)) | ||
|
||
// files | ||
app.Post("/v1/files", auth, openai.UploadFilesEndpoint(cl, appConfig)) | ||
app.Post("/files", auth, openai.UploadFilesEndpoint(cl, appConfig)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it maybe makes more sense to call this FilesDir, at a first glance I thought this was a directory for LocalAI config files