This commit is contained in:
2023-12-18 12:03:58 +00:00
parent 4c8f021d40
commit 3f17e10009
4 changed files with 150 additions and 122 deletions

View File

@@ -406,7 +406,7 @@ function isUseTools(a::agentReflex)
response = sendReceivePrompt(a, prompt, temperature=0.0)
response = split(response, "<|im_end|>")[1]
for (toolname, v) in a.tools
if occursin(toolname, response)
if occursin(toolname, String(response))
isusetool = true
break
end
@@ -867,6 +867,7 @@ end
Arguments:
text = a text you want to split
headers = a list of keywords you want to add step and substep to
step = a number you want to add
Return:
a leftmost text after split
@@ -884,11 +885,10 @@ function replaceHeaders(text::T, headers, step::Int) where {T<:AbstractString}
header = i[1:end-1] # not include ":"
if occursin(header, newtext)
startind = findfirst(header, newtext)[1]
stopind = findnext(":", newtext, startind+1)[end]
stopind = findnext(":", newtext, startind+1)[end] #BUG MethodError: no method matching lastindex(::Nothing)
word = newtext[startind: stopind]
newword = "$header $step:"
newtext = replace(newtext, word=> newword)
end
end