Files
zhaoyupeng.elqbandTRAE CLI 81deca8c8e feat: initialize Eino examples and ADK applications
Include chat, weather, image, travel, streaming ASR and text examples,
shared model initialization, documentation, and existing tests.

Co-authored-by: TRAE CLI <traecli@bytedance.com>
2026-11-19 11:08:03 +08:00

34 lines
870 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package agent
import (
"context"
"fmt"
"strings"
"example.com/ueino/pkg/model"
"github.com/cloudwego/eino/adk"
)
// travelProgress 是流程中的用户可见正文,不是内部日志。
type travelProgress string
func emitTravelText(ctx context.Context, text string) error {
if err := ctx.Err(); err != nil {
return err
}
return adk.SendEvent(ctx, &adk.AgentEvent{
Output: &adk.AgentOutput{CustomizedOutput: travelProgress(text)},
})
}
func travelWeatherText(weather model.WeatherForecast) string {
var text strings.Builder
fmt.Fprintf(&text, "查到%s的天气:\n", weather.Location)
for _, day := range weather.Days {
fmt.Fprintf(&text, "%s:%s,%g~%g°C,最高降雨概率%g%%。\n",
day.Date, day.Condition, day.MinTemperatureC, day.MaxTemperatureC, day.PrecipitationChancePct)
}
text.WriteString("\n")
return text.String()
}