mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
fix(artifacts): render artifacts from the checked path and serve raw files once
- show_artifact returns the validated path as tool metadata; the chat card renders from it and maps repo paths with getWorkspaceFilePath, so local repos and moved sessions load the right file - serve .htm as text/html - raw file route stats and reads once and adds ETag/Last-Modified with 304 - reuse isPathWithinRoot from utils/fs-safe - move readShowArtifactCall to frontend/src/lib/artifactTool
This commit is contained in:
1 parent
f7b2ffb865
commit
5e2452172c
26 files changed
+489
-58
No files matched your search
@@ -255,7 +255,10 @@ var ACTIONS = {
|
||||
{ path: params.path },
|
||||
context.signal,
|
||||
)
|
||||
return 'Showing the artifact "' + params.title + '" from ' + result.path + ' in the Manager chat. It renders the current file contents, so after editing the file the user can reload the view; call show_artifact again only to show a different file.'
|
||||
return {
|
||||
content: 'Showing the artifact "' + params.title + '" from ' + result.path + ' in the Manager chat. It renders the current file contents, so after editing the file the user can reload the view; call show_artifact again only to show a different file.',
|
||||
metadata: { path: result.path },
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -294,7 +297,11 @@ export default {
|
||||
input: INPUT_SCHEMA,
|
||||
options: { codemode: false },
|
||||
execute: async function (input, context) {
|
||||
return { content: await runAction(input, context) }
|
||||
var result = await runAction(input, context)
|
||||
if (result !== null && typeof result === 'object') {
|
||||
return result
|
||||
}
|
||||
return { content: result }
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user