This commit is contained in:
narawat lamaiin
2025-01-20 18:19:38 +07:00
parent 4197625e57
commit bb81b973d3
3 changed files with 71 additions and 33 deletions

View File

@@ -307,6 +307,8 @@ function checkinventory(a::T1, input::T2
println("\n~~~ checkinventory result ", Dates.now(), " ", @__FILE__, " ", @__LINE__)
println(textresult)
#[WORKING] when rawresponse is nothing, AI get errors
return (result=textresult, rawresponse=rawresponse, success=true, errormsg=nothing)
end
@@ -412,6 +414,8 @@ function extractWineAttributes_1(a::T1, input::T2)::String where {T1<:agent, T2<
responsedict = copy(JSON3.read(response))
# convert
delete!(responsedict, :reasoning)
delete!(responsedict, :tasting_notes)
delete!(responsedict, :occasion)
@@ -444,7 +448,9 @@ function extractWineAttributes_1(a::T1, input::T2)::String where {T1<:agent, T2<
end
else
content = responsedict[j]
if occursin(',', content)
if typeof(content) <: AbstractVector
content = strip.(content)
elseif occursin(',', content)
content = split(content, ",") # sometime AI generates multiple values e.g. "Chenin Blanc, Riesling"
content = strip.(content)
else