sync: migrate ai-operator to Gitea (2026-08-10)

This commit is contained in:
konturai-ops
2026-08-10 15:26:52 +00:00
commit 53652b95ad
173 changed files with 16676 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
package fake
import (
"ai-operator/internal/ai"
"ai-operator/internal/media"
"context"
"testing"
"time"
)
func TestFakeProvider(t *testing.T) {
p := New()
ctx := context.Background()
if err := p.StartSession(ctx, ai.VoiceSessionConfig{CallID: "c1"}); err != nil {
t.Fatal(err)
}
if err := p.SendAudio(ctx, media.AudioChunk{CallID: "c1", Data: []byte{0, 0}, Timestamp: time.Now()}); err != nil {
t.Fatal(err)
}
if st := p.Stats(); st.InputAudioFrames != 1 || st.InputAudioBytes != 2 {
t.Fatalf("stats=%+v", st)
}
_ = p.Close(ctx)
}
func TestFakeProviderCanStartAfterClose(t *testing.T) {
p := New()
ctx := context.Background()
for _, callID := range []string{"c1", "c2"} {
if err := p.StartSession(ctx, ai.VoiceSessionConfig{CallID: callID}); err != nil {
t.Fatal(err)
}
if err := p.Close(ctx); err != nil {
t.Fatal(err)
}
for range p.Events() {
}
}
}