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>
This commit is contained in:
zhaoyupeng.elqbandTRAE CLI committed 2026-11-19 11:08:03 +08:00
commit 81deca8c8e
75 files changed
+7048

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
package terminal
import (
"context"
"errors"
"io"
"strings"
"testing"
)
func TestConfirmImage(t *testing.T) {
for _, tt := range []struct {
name, input string
approved bool
err error
}{
{name: "确认", input: "y\n继续\n", approved: true},
{name: "拒绝", input: "n\n继续\n"},
{name: "默认拒绝", input: "\n继续\n"},
{name: "纠正输入", input: "maybe\n确认\n继续\n", approved: true},
{name: "输入结束", err: io.EOF},
} {
t.Run(tt.name, func(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
input := newInput(ctx, strings.NewReader(tt.input))
approved, err := confirmImage(ctx, input, "画一只猫")
if approved != tt.approved || !errors.Is(err, tt.err) {
t.Fatalf("确认结果 = %v,错误 = %v", approved, err)
}
if err == nil {
line, err := input.next(ctx)
if err != nil || line != "继续" {
t.Fatal("确认不应吞掉下一条聊天输入")
}
}
})
}
}