update
This commit is contained in:
68
src/util.jl
68
src/util.jl
@@ -1,7 +1,7 @@
|
||||
module util
|
||||
|
||||
export clearhistory, addNewMessage, chatHistoryToText, eventdict, noises, createTimeline,
|
||||
availableWineToText
|
||||
availableWineToText, createEventsLog
|
||||
|
||||
using UUIDs, Dates, DataStructures, HTTP, JSON3
|
||||
using GeneralUtils
|
||||
@@ -313,35 +313,47 @@ function createTimeline(events::T1; eventindex::Union{UnitRange, Nothing}=nothin
|
||||
end
|
||||
|
||||
|
||||
# function createTimeline(events::T1; eventindex::Union{UnitRange, Nothing}=nothing
|
||||
# ) where {T1<:AbstractVector}
|
||||
# # Initialize empty timeline string
|
||||
# timeline = ""
|
||||
|
||||
# # Determine which indices to use - either provided range or full length
|
||||
# ind =
|
||||
# if eventindex !== nothing
|
||||
# [eventindex...]
|
||||
# else
|
||||
# 1:length(events)
|
||||
# end
|
||||
function createEventsLog(events::T1; eventindex::Union{UnitRange, Nothing}=nothing
|
||||
) where {T1<:AbstractVector}
|
||||
# Initialize empty log array
|
||||
log = Dict{Symbol, String}[]
|
||||
|
||||
# Determine which indices to use - either provided range or full length
|
||||
ind =
|
||||
if eventindex !== nothing
|
||||
[eventindex...]
|
||||
else
|
||||
1:length(events)
|
||||
end
|
||||
|
||||
# Iterate through events and format each one
|
||||
for (i, event) in zip(ind, events)
|
||||
# If no outcome exists, format without outcome
|
||||
if event[:outcome] === nothing
|
||||
subject = event[:subject]
|
||||
actioninput = event[:actioninput]
|
||||
d = Dict{Symbol, String}(:name=>subject, :text=>actioninput)
|
||||
push!(log, d)
|
||||
else
|
||||
subject = event[:subject]
|
||||
actioninput = event[:actioninput]
|
||||
outcome = event[:outcome]
|
||||
str = "$subject: $actioninput $outcome"
|
||||
d = Dict{Symbol, String}(:name=>subject, :text=>str)
|
||||
push!(log, d)
|
||||
end
|
||||
end
|
||||
|
||||
return log
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# # Iterate through events and format each one
|
||||
# for (i, event) in zip(ind, events)
|
||||
# # If no outcome exists, format without outcome
|
||||
# subject = titlecase(event[:subject])
|
||||
# if event[:outcome] === nothing
|
||||
|
||||
# timeline *= "Event_$i) Who: $subject Action_name: $(event[:actionname]) Action_input: $(event[:actioninput])\n"
|
||||
# # If outcome exists, include it in formatting
|
||||
# else
|
||||
# timeline *= "Event_$i) Who: $subject Action_name: $(event[:actionname]) Action_input: $(event[:actioninput]) Action output: $(event[:outcome])\n"
|
||||
# end
|
||||
# end
|
||||
|
||||
# # Return formatted timeline string
|
||||
# return timeline
|
||||
# end
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user