Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
add: debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
iwilltry42 committed May 27, 2024
1 parent 2ff91a0 commit 465f52b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ go.work

# Env
.env

knowledge/
2 changes: 1 addition & 1 deletion pkg/cmd/askdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ func (s *ClientAskDir) Run(cmd *cobra.Command, args []string) error {
}

if s.FlowsFile != "" {

abspath, err := filepath.Abs(path)
if err != nil {
return fmt.Errorf("failed to get absolute path from %q: %w", path, err)
}

datasetID := client.HashPath(abspath)

slog.Debug("Loading ingestion flows from config", "flows_file", s.FlowsFile, "dataset", datasetID)
flowCfg, err := flowconfig.FromFile(s.FlowsFile)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func (s *ClientIngest) Run(cmd *cobra.Command, args []string) error {
}

if s.FlowsFile != "" {
slog.Debug("Loading ingestion flows from config", "flows_file", s.FlowsFile, "dataset", datasetID)
flowCfg, err := flowconfig.FromFile(s.FlowsFile)
if err != nil {
return err
Expand Down
3 changes: 3 additions & 0 deletions pkg/flows/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/gptscript-ai/knowledge/pkg/datastore/documentloader"
"github.com/gptscript-ai/knowledge/pkg/datastore/textsplitter"
"github.com/gptscript-ai/knowledge/pkg/flows"
"log/slog"
"os"
"sigs.k8s.io/yaml"
"strings"
Expand Down Expand Up @@ -159,7 +160,9 @@ func (i *IngestionFlowConfig) AsIngestionFlow() (*flows.IngestionFlow, error) {
func (f *FlowConfig) ForDataset(name string) (*FlowConfigEntry, error) {
flowref, ok := f.Datasets[name]
if ok {
slog.Debug("Flow assigned to dataset", "dataset", name, "flow", flowref)
return f.GetFlow(flowref)
}
slog.Debug("No flow found for dataset - using default", "dataset", name)
return f.GetDefaultFlowConfigEntry()
}

0 comments on commit 465f52b

Please sign in to comment.