update
This commit is contained in:
36
src/util.jl
36
src/util.jl
@@ -102,7 +102,7 @@ end
|
||||
-----
|
||||
"""
|
||||
function addNewMessage(a::T1, name::String, text::T2;
|
||||
maximumMsg::Integer=20) where {T1<:agent, T2<:AbstractString}
|
||||
maximumMsg::Integer=30) where {T1<:agent, T2<:AbstractString}
|
||||
if name ∉ ["system", "user", "assistant"] # guard against typo
|
||||
error("name is not in agent.availableRole $(@__LINE__)")
|
||||
end
|
||||
@@ -231,8 +231,8 @@ function eventdict(;
|
||||
timestamp::Union{DateTime, Nothing}=nothing,
|
||||
subject::Union{String, Nothing}=nothing,
|
||||
thought::Union{AbstractDict, Nothing}=nothing,
|
||||
action_name::Union{String, Nothing}=nothing, # "CHAT", "CHECKINVENTORY", "PRESENTBOX", etc
|
||||
action_input::Union{String, Nothing}=nothing,
|
||||
actionname::Union{String, Nothing}=nothing, # "CHAT", "CHECKINVENTORY", "PRESENTBOX", etc
|
||||
actioninput::Union{String, Nothing}=nothing,
|
||||
location::Union{String, Nothing}=nothing,
|
||||
equipment_used::Union{String, Nothing}=nothing,
|
||||
material_used::Union{String, Nothing}=nothing,
|
||||
@@ -245,8 +245,8 @@ function eventdict(;
|
||||
:timestamp=> timestamp,
|
||||
:subject=> subject,
|
||||
:thought=> thought,
|
||||
:action_name=> action_name,
|
||||
:action_input=> action_input,
|
||||
:actionname=> actionname,
|
||||
:actioninput=> actioninput,
|
||||
:location=> location,
|
||||
:equipment_used=> equipment_used,
|
||||
:material_used=> material_used,
|
||||
@@ -302,14 +302,14 @@ function createTimeline(events::T1; eventindex::Union{UnitRange, Nothing}=nothin
|
||||
event = events[i]
|
||||
# If no outcome exists, format without outcome
|
||||
# if event[:actionname] == "CHATBOX"
|
||||
# timeline *= "Event_$i $(event[:subject])> action_name: $(event[:actionname]), action_input: $(event[:actioninput])\n"
|
||||
# timeline *= "Event_$i $(event[:subject])> actionname: $(event[:actionname]), actioninput: $(event[:actioninput])\n"
|
||||
# elseif event[:actionname] == "CHECKINVENTORY" && event[:observation] === nothing
|
||||
# timeline *= "Event_$i $(event[:subject])> action_name: $(event[:actionname]), action_input: $(event[:actioninput]), observation: Not done yet.\n"
|
||||
# timeline *= "Event_$i $(event[:subject])> actionname: $(event[:actionname]), actioninput: $(event[:actioninput]), observation: Not done yet.\n"
|
||||
# If outcome exists, include it in formatting
|
||||
if event[:action_name] == "CHECKWINE"
|
||||
timeline *= "Event_$i $(event[:subject])> action_name: $(event[:action_name]), action_input: $(event[:action_input]), observation: $(event[:observation])\n"
|
||||
if event[:actionname] == "CHECKWINE"
|
||||
timeline *= "Event_$i $(event[:subject])> actionname: $(event[:actionname]), actioninput: $(event[:actioninput]), observation: $(event[:observation])\n"
|
||||
else
|
||||
timeline *= "Event_$i $(event[:subject])> action_name: $(event[:action_name]), action_input: $(event[:action_input])\n"
|
||||
timeline *= "Event_$i $(event[:subject])> actionname: $(event[:actionname]), actioninput: $(event[:actioninput])\n"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -334,10 +334,10 @@ end
|
||||
# event = events[i]
|
||||
# # If no outcome exists, format without outcome
|
||||
# if event[:observation] === nothing
|
||||
# timeline *= "Event_$i $(event[:subject])> action_name: $(event[:actionname]), action_input: $(event[:actioninput]), observation: Not done yet.\n"
|
||||
# timeline *= "Event_$i $(event[:subject])> actionname: $(event[:actionname]), actioninput: $(event[:actioninput]), observation: Not done yet.\n"
|
||||
# # If outcome exists, include it in formatting
|
||||
# else
|
||||
# timeline *= "Event_$i $(event[:subject])> action_name: $(event[:actionname]), action_input: $(event[:actioninput]), observation: $(event[:observation])\n"
|
||||
# timeline *= "Event_$i $(event[:subject])> actionname: $(event[:actionname]), actioninput: $(event[:actioninput]), observation: $(event[:observation])\n"
|
||||
# end
|
||||
# end
|
||||
|
||||
@@ -365,17 +365,17 @@ function createEventsLog(events::T1; index::Union{UnitRange, Nothing}=nothing
|
||||
# If no outcome exists, format without outcome
|
||||
if event[:observation] === nothing
|
||||
subject = event[:subject]
|
||||
action_name = event[:action_name]
|
||||
action_input = event[:action_input]
|
||||
str = "Action_name: $action_name, Action_input: $action_input"
|
||||
actionname = event[:actionname]
|
||||
actioninput = event[:actioninput]
|
||||
str = "actionname: $actionname, actioninput: $actioninput"
|
||||
d = Dict{Symbol, String}(:name=>subject, :text=>str)
|
||||
push!(log, d)
|
||||
else
|
||||
subject = event[:subject]
|
||||
action_name = event[:action_name]
|
||||
action_input = event[:action_input]
|
||||
actionname = event[:actionname]
|
||||
actioninput = event[:actioninput]
|
||||
observation = event[:observation]
|
||||
str = "Action_name: $action_name, Action_input: $action_input, Observation: $observation"
|
||||
str = "actionname: $actionname, actioninput: $actioninput, observation: $observation"
|
||||
d = Dict{Symbol, String}(:name=>subject, :text=>str)
|
||||
push!(log, d)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user