fix(plantask): normalize listed file paths#1135
Open
claneo wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
fix
Check the PR title.
(Optional) Translate the PR title into Chinese.
修复 plantask 读取列表文件路径时的归一化处理
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
This PR normalizes paths returned by
Backend.LsInfobeforeplantaskcallsBackend.Read.filesystem.FileInfo.Pathmay be a filename, relative path, or absolute path. Some filesystem backends, including the in-memory backend and the local backend ineino-ext, return filenames fromLsInfo.plantaskpreviously passed those values directly toRead, which could read from the process working directory instead of the configured taskBaseDir.This change follows the existing pattern used by
adk/middlewares/skill/filesystem_backend.go: if the listed path is not absolute, join it with the configured base directory before reading.Added regression tests for
TaskCreateandTaskListwith a backend whoseLsInforeturns basenames.zh(optional):
本 PR 在
plantask调用Backend.Read前,对Backend.LsInfo返回的路径进行归一化处理。filesystem.FileInfo.Path可以是文件名、相对路径或绝对路径。部分 backend(包括 in-memory backend 和eino-ext中的 local backend)会在LsInfo中返回文件名。此前plantask会直接把该值传给Read,可能导致从进程当前工作目录读取,而不是从配置的任务BaseDir读取。本改动对齐
adk/middlewares/skill/filesystem_backend.go中的已有处理方式:如果列表返回路径不是绝对路径,则先与配置的 base directory 拼接后再读取。同时补充了
TaskCreate和TaskList在LsInfo返回 basename 时的回归测试。(Optional) Which issue(s) this PR fixes:
Related to cloudwego/eino-ext#908
(optional) The PR that updates user documentation:
N/A