feat: add streaming text Chain example and simplify ASR flow

Add character-by-character fake input, event collection, request logging,
and a model pre-handler to the steps/trans example.

Split the ASR Chain into readable node functions, strip transcript markers,
configure the local ASR service, and remove the ASR example test files.

Co-authored-by: TRAE CLI <traecli@bytedance.com>
This commit is contained in:
zhaoyupeng.elqbandTRAE CLI committed 2026-11-18 21:26:29 +08:00
1 parent 2cf82034ec
commit ee8afb10db
9 files changed
+325 -357

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
package main
import (
"context"
"fmt"
"io"
"log"
"os"
"os/signal"
"syscall"
"example.com/ueino/steps/trans/internal"
)
func main() {
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer cancel()
chain, err := internal.NewChain(ctx, internal.MustNewChatModel(ctx))
if err != nil {
log.Panicf("new chain err: %v", err)
}
output, err := chain.Transform(ctx, internal.FakeInput())
if err != nil {
log.Panicf("chain transform err: %v", err)
}
defer output.Close()
for {
message, err := output.Recv()
if err == io.EOF {
fmt.Println()
break
}
if err != nil {
log.Panicf("output received err: %v", err)
}
fmt.Print(message.Content)
}
log.Println("[I] Done!!!")
}