From fddae42f5bd08ecd90bb302d2c044d7f7d1dcd0c Mon Sep 17 00:00:00 2001 From: narawat Date: Fri, 17 Nov 2023 05:57:21 +0000 Subject: [PATCH] fix bug --- src/interface.jl | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index 285de11..5eda3bf 100755 --- a/src/interface.jl +++ b/src/interface.jl @@ -384,12 +384,16 @@ function conversation(a::T, usermsg::String) where {T<:agent} prompt = generatePrompt_react_mistral_openorca(a, usermsg) @show prompt respond = work(a, prompt) + + + + error("wine done") else # continue thought end - error("wine done") + elseif userintend == "thought" else @@ -423,10 +427,10 @@ function work(a::T, prompt::String) where {T<:agent} while true respond = sendReceivePrompt(a, prompt) @show respond - header = detectCharacters(respond, + headers = detectCharacters(respond, ["QTS:", "Plan:", "Thought:", "Act:", "ActInput:", "Obs:", ".....", "ANS:"]) - - + @show headers + break @@ -447,7 +451,7 @@ function work(a::T, prompt::String) where {T<:agent} - + return respond end """ @@ -486,7 +490,7 @@ function conversationSummary(a::T) where {T<:agent} {context} <|im_start|>user - Please make a detailed bullet summary of the following earlier conversation between you and the user. + Please make a detailed bullet summary of the following earlier conversation between you and a user. {conversation} <|im_end|> <|im_start|>I @@ -771,8 +775,11 @@ function detectCharacters(text::T1, characters::Vector{T2}) where {T1<:AbstractS if char_endInd > length(text) # skip else - if text[char_startInd: char_endInd] == char - push!(result, (char=char, start=char_startInd, stop=char_endInd)) + try # some time StringIndexError: invalid index [535], valid nearby indices [534]=>'é', [536]=>' ' + if text[char_startInd: char_endInd] == char + push!(result, (char=char, start=char_startInd, stop=char_endInd)) + end + catch end end end