Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Daishan Peng <[email protected]>
  • Loading branch information
StrongMonkey committed Oct 23, 2024
1 parent 4595e45 commit a42f686
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
8 changes: 4 additions & 4 deletions pkg/controller/handlers/knowledge/knowledge.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,19 +300,19 @@ func updateIngestionError(req router.Request, ws *v1.Workspace, runName string)
}
}

if run.Status.State == gptscript.Finished || run.Status.State == gptscript.Error {
if run.Status.State.IsTerminal() {
return true, nil
}

return false, nil
}

func compileFileStatuses(ctx context.Context, client kclient.Client, ws *v1.Workspace, progress <-chan types.Progress) (map[string]types.Item, error) {
func compileFileStatuses(ctx context.Context, client kclient.Client, ws *v1.Workspace, progress <-chan types.Progress) (map[string]string, error) {
input := toStream(progress)
defer input.Close()
scanner := bufio.NewScanner(input)

final := map[string]types.Item{}
final := map[string]string{}

var errs []error
for scanner.Scan() {
Expand All @@ -339,7 +339,7 @@ func compileFileStatuses(ctx context.Context, client kclient.Client, ws *v1.Work
} else if err != nil {
errs = append(errs, fmt.Errorf("failed to get knowledge file: %s", err))
}
final[file.Name] = struct{}{}
final[file.Name] = ingestionStatus.Status

if ingestionStatus.Status == "finished" {
delete(final, file.Name)
Expand Down
21 changes: 10 additions & 11 deletions pkg/storage/apis/otto.gptscript.ai/v1/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package v1

import (
"github.com/acorn-io/baaah/pkg/fields"
"github.com/otto8-ai/otto8/apiclient/types"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -64,16 +63,16 @@ type WorkspaceSpec struct {
}

type WorkspaceStatus struct {
WorkspaceID string `json:"workspaceID,omitempty"`
IngestionGeneration int64 `json:"ingestionGeneration,omitempty"`
IngestionRunHash string `json:"ingestionRunHash,omitempty"`
IngestionRunName string `json:"ingestionRunName,omitempty"`
IngestionLastRunTime metav1.Time `json:"ingestionLastRunTime,omitempty"`
LastNotFinished map[string]types.Item `json:"lastNotFinished,omitempty"`
NotFinished map[string]types.Item `json:"notFinished,omitempty"`
RetryCount int `json:"retryCount,omitempty"`
PendingApproval []string `json:"pendingApproval,omitempty"`
PendingRejections []string `json:"pendingRejections,omitempty"`
WorkspaceID string `json:"workspaceID,omitempty"`
IngestionGeneration int64 `json:"ingestionGeneration,omitempty"`
IngestionRunHash string `json:"ingestionRunHash,omitempty"`
IngestionRunName string `json:"ingestionRunName,omitempty"`
IngestionLastRunTime metav1.Time `json:"ingestionLastRunTime,omitempty"`
LastNotFinished map[string]string `json:"lastNotFinished,omitempty"`
NotFinished map[string]string `json:"notFinished,omitempty"`
RetryCount int `json:"retryCount,omitempty"`
PendingApproval []string `json:"pendingApproval,omitempty"`
PendingRejections []string `json:"pendingRejections,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions pkg/storage/openapi/generated/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a42f686

Please sign in to comment.