From ec8cc6bbf9eef9e8aead4452e4f934a7a3fd2548 Mon Sep 17 00:00:00 2001 From: tonaerospace Date: Tue, 5 Dec 2023 07:28:27 +0000 Subject: [PATCH] update --- src/interface.jl | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index 9383ef9..c66cec5 100755 --- a/src/interface.jl +++ b/src/interface.jl @@ -1156,12 +1156,7 @@ julia> decision = goNogo(agent) """ function goNogo(a) stimulus = a.memory[:shortterm]["user:"] - work = "" - for (k, v) in a.memory[:shortterm] - if k ∉ ["user:"] - work *= "$k $v" - end - end + work = shortMemoryToString(a.memory[:shortterm], ["user:"]) # prompt = # """ @@ -1204,10 +1199,9 @@ function goNogo(a) Your work: $work - From the latest step in your work, you job is to choose one of the following choices: + Consider the plan and Obs $(a.step), your job is to choose one of the following choices: If you need to repeat the latest step say, "{No}". And what is the rationale behind the decision? If you are ready to do the next step of the plan say, "{Yes}". And what is the rationale behind the decision? - If you are ready to formulate a final respond to user original stimulus say, {formulateUserRespond}. And what is the rationale behind the decision? <|im_end|> """ @@ -1221,19 +1215,22 @@ function goNogo(a) reason = nothing if occursin("Yes", respond) decision = "Yes" - startInd = startInd = findfirst("Yes", respond)[end] +2 - reason = respond[startInd:end] elseif occursin("No", respond) decision = "No" - startInd = startInd = findfirst("No", respond)[end] +2 - reason = respond[startInd:end] elseif occursin("formulateUserRespond", respond) decision = "formulateUserRespond" - startInd = startInd = findfirst("formulateUserRespond", respond)[end] +2 - reason = respond[startInd:end] else + error("undefied condition, decision $decision $(@__LINE__)") end + startInd = findfirst(decision, respond)[end] +2 + + if occursin(":", respond[startInd:end]) # check for ":" after decision cha + startInd2 = findnext(":", respond, startInd)[end]+1 + reason = respond[startInd2:end] + else + reason = respond[startInd:end] + end return decision, reason end