Skip to content

Commit

Permalink
fix: 🐛 handle empty prompt messages and root children
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Oct 24, 2024
1 parent 80067bd commit edae142
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/expander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export async function expandTemplate(
messages,
}

if (status !== "success")
if (status !== "success" || prompt.messages.length === 0)
// cancelled
return {
status,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/promptdom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ async function tracePromptNode(
root: PromptNode,
options?: { label: string }
) {
if (!trace) return
if (!trace || !root.children?.length) return

await visitNode(root, {
node: (n) => {
Expand Down

0 comments on commit edae142

Please sign in to comment.