Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adk/middlewares/plantask/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (b *inMemoryBackend) LsInfo(ctx context.Context, req *LsInfoRequest) ([]Fil
for path := range b.files {
dir := filepath.Dir(path)
if dir == reqPath {
result = append(result, FileInfo{Path: path})
result = append(result, FileInfo{Path: filepath.Base(path)})
}
}
return result, nil
Expand Down
9 changes: 9 additions & 0 deletions adk/middlewares/plantask/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package plantask

import (
"context"
"path/filepath"
"regexp"

"github.com/cloudwego/eino/adk/middlewares/filesystem"
Expand Down Expand Up @@ -90,6 +91,14 @@ func appendUnique(slice []string, items ...string) []string {
return slice
}

func resolveListedFilePath(baseDir, listedPath string) string {
if filepath.IsAbs(listedPath) {
return listedPath
}

return filepath.Join(baseDir, listedPath)
}

func hasCyclicDependency(taskMap map[string]*task, blockerID, blockedID string) bool {
if blockerID == blockedID {
return true
Expand Down
3 changes: 2 additions & 1 deletion adk/middlewares/plantask/task_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ func (t *taskCreateTool) InvokableRun(ctx context.Context, argumentsInJSON strin
for _, file := range files {
fileName := filepath.Base(file.Path)
if fileName == highWatermarkFileName {
filePath := resolveListedFilePath(t.BaseDir, file.Path)
content, readErr := t.Backend.Read(ctx, &ReadRequest{
FilePath: file.Path,
FilePath: filePath,
})
if readErr != nil {
return "", fmt.Errorf("%s read highwatermark file %s failed, err: %w", TaskCreateToolName, file.Path, readErr)
Expand Down
3 changes: 2 additions & 1 deletion adk/middlewares/plantask/task_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ func listTasks(ctx context.Context, backend Backend, baseDir string) ([]*task, e
continue
}

filePath := resolveListedFilePath(baseDir, file.Path)
content, err := backend.Read(ctx, &ReadRequest{
FilePath: file.Path,
FilePath: filePath,
})
if err != nil {
return nil, fmt.Errorf("%s read task file %s failed, err: %w", TaskListToolName, file.Path, err)
Expand Down