Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not call llm on empty prompt #614

Merged
merged 1 commit into from
Aug 12, 2024
Merged
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 packages/core/src/expander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export async function expandTemplate(
if (prompt.aici) trace.fence(prompt.aici, "yaml")
trace.endDetails()

if (prompt.status !== "success")
if (prompt.status !== "success" || prompt.text === "")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check for an empty string in the condition prompt.text === "" might not be necessary if prompt.status is not "success". If the status is not "success", it implies that the operation failed or was cancelled, so the text might not be relevant in this context. 🤔

generated by pr-review-commit empty_string_check

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic of the condition has been changed with the addition of prompt.text === "". This might lead to different behavior of the code if prompt.text is an empty string. If this change was intentional, it would be good to add a comment explaining why this change was made. 😊

generated by pr-review-commit logic_change

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition prompt.text === "" has been added without any comment or explanation. It would be helpful to add a comment explaining why this condition is necessary, to make the code easier to understand for other developers. 📝

generated by pr-review-commit missing_comment

// cancelled
return { status: prompt.status, statusText: prompt.statusText }

Expand Down