add intro

This commit is contained in:
2026-08-28 22:02:58 +07:00
parent 5fcbf6f2c5
commit 1a05799b2d
17 changed files with 1103 additions and 364 deletions
+22 -1
View File
@@ -47,7 +47,18 @@ func mapStory(o *storytelling.Story) *proto.Story {
return nil
}
return &proto.Story{
Places: mapPlaces(o.Places),
Introduction: mapIntroduction(o.Introduction),
Places: mapPlaces(o.Places),
}
}
func mapIntroduction(o *storytelling.Introduction) *proto.Introduction {
if o == nil {
return nil
}
return &proto.Introduction{
Text: o.Text,
Audio: o.Audio,
}
}
@@ -174,3 +185,13 @@ func convertKey(o *proto.Key) *storytelling.Key {
Name: textFormatter.FormatString(o.Name),
}
}
func convertIntroduction(o *proto.Introduction) *storytelling.Introduction {
if o == nil || (o.Text == "" && o.Audio == "") {
return nil
}
return &storytelling.Introduction{
Text: textFormatter.FormatText(o.Text),
Audio: o.Audio,
}
}