This commit is contained in:
narawat lamaiin
2025-04-25 21:12:27 +07:00
parent 48a3704f6d
commit 44804041a3
3 changed files with 81 additions and 58 deletions

View File

@@ -284,35 +284,6 @@ timeline = createTimeline(events)
# 2) Assistant> Hi there! with a smile
"""
# 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
# # 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
# timeline *= "Event_$i $(event[:subject])> $(event[:actioninput])\n"
# # If outcome exists, include it in formatting
# else
# timeline *= "Event_$i $(event[:subject])> $(event[:actioninput]) $(event[:outcome])\n"
# end
# end
# # Return formatted timeline string
# return timeline
# end
function createTimeline(events::T1; eventindex::Union{UnitRange, Nothing}=nothing
) where {T1<:AbstractVector}
# Initialize empty timeline string
@@ -329,13 +300,11 @@ function createTimeline(events::T1; eventindex::Union{UnitRange, Nothing}=nothin
# 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"
timeline *= "Event_$i $(event[:subject])> $(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"
timeline *= "Event_$i $(event[:subject])> $(event[:actioninput]) $(event[:outcome])\n"
end
end
@@ -344,6 +313,37 @@ 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
# # 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