Skip to content

Commit

Permalink
fix: correctly handle error message
Browse files Browse the repository at this point in the history
  • Loading branch information
lynchee-owo committed Mar 19, 2024
1 parent 9b3a4fe commit d2212d8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/helpers/determineNextAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ This is an example of an action:
action: "click('12')"
}
If the task involves setting value, must use setValue action. If input does not exist on screen, click first and then setValue.
Your response must always be in JSON format and must include "thought" and "action".
When finish, use "finish()" in "action" and include a brief summary of the task in "thought"; if user is seeking an answer, also include the answer in "thought".
`;
Expand Down Expand Up @@ -158,7 +159,7 @@ ${labelData.map((item) => tomlLikeStringifyObject(item)).join("\n===\n")}`;
// TODO: need to verify the new API error format
console.error("determineNextAction error:");
console.error(error);
if (error.includes("server error")) {
if (error.message.includes("server error")) {
// Problem with the OpenAI API, try again
if (notifyError) {
notifyError(error);
Expand Down Expand Up @@ -222,7 +223,7 @@ export async function determineNextAction(
// TODO: need to verify the new API error format
console.error("determineNextAction error:");
console.error(error);
if (error.includes("server error")) {
if (error.message.includes("server error")) {
// Problem with the OpenAI API, try again
if (notifyError) {
notifyError(error);
Expand Down

0 comments on commit d2212d8

Please sign in to comment.