feat(upload): add process configuration support to CreateKnowledgeFromFile
- Updated the CreateKnowledgeFromFile function to accept an optional processConfig parameter, enhancing flexibility in knowledge file uploads. - Modified related service and test files to accommodate the new parameter, ensuring consistent handling across the upload process.
This commit is contained in:
@@ -62,6 +62,7 @@ type UploadService interface {
|
||||
metadata map[string]string,
|
||||
enableMultimodel *bool,
|
||||
customFileName, channel string,
|
||||
processConfig *sdk.KnowledgeProcessOverrides,
|
||||
) (*sdk.Knowledge, error)
|
||||
}
|
||||
|
||||
@@ -294,7 +295,7 @@ func runUpload(ctx context.Context, opts *UploadOptions, fopts *cmdutil.FormatOp
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
k, err := svc.CreateKnowledgeFromFile(ctx, kbID, path, meta, opts.EnableMultimodel, opts.Name, cmp.Or(opts.Channel, uploadChannel))
|
||||
k, err := svc.CreateKnowledgeFromFile(ctx, kbID, path, meta, opts.EnableMultimodel, opts.Name, cmp.Or(opts.Channel, uploadChannel), nil)
|
||||
if err != nil {
|
||||
if errors.Is(err, sdk.ErrDuplicateFile) {
|
||||
// SDK returns sentinel without an "HTTP error <status>:" prefix
|
||||
|
||||
@@ -85,7 +85,7 @@ func runUploadRecursive(ctx context.Context, opts *UploadOptions, fopts *cmdutil
|
||||
channel := cmp.Or(opts.Channel, uploadChannel)
|
||||
|
||||
outcomes, runErr := cmdutil.RunBatch(ctx, matches, func(ctx context.Context, p string) error {
|
||||
k, err := svc.CreateKnowledgeFromFile(ctx, kbID, p, meta, opts.EnableMultimodel, "", channel)
|
||||
k, err := svc.CreateKnowledgeFromFile(ctx, kbID, p, meta, opts.EnableMultimodel, "", channel, nil)
|
||||
if err != nil {
|
||||
code := cmdutil.ClassifyHTTPError(err)
|
||||
if firstFailCode == "" {
|
||||
|
||||
@@ -40,6 +40,7 @@ func (s *scriptedUploadSvc) CreateKnowledgeFromFile(
|
||||
metadata map[string]string,
|
||||
enableMultimodel *bool,
|
||||
_, channel string,
|
||||
_ *sdk.KnowledgeProcessOverrides,
|
||||
) (*sdk.Knowledge, error) {
|
||||
s.called = append(s.called, filepath.Base(filePath))
|
||||
s.lastMetadata = metadata
|
||||
|
||||
@@ -34,6 +34,7 @@ func (f *fakeUploadSvc) CreateKnowledgeFromFile(
|
||||
metadata map[string]string,
|
||||
enableMultimodel *bool,
|
||||
customFileName, channel string,
|
||||
_ *sdk.KnowledgeProcessOverrides,
|
||||
) (*sdk.Knowledge, error) {
|
||||
f.got.kbID = kbID
|
||||
f.got.filePath = filePath
|
||||
|
||||
Reference in New Issue
Block a user