feat: source-model routing disambiguation (source-model/:/ prefix); same-tier round-robin load balancing; public_base_url for copy config; fmtTok(B/M/K) unit scaling; status column reorder (reachability first); drop emoji from seed-warn modal; fix tests for first-run adapter seeding; install lua5.1 dev lib

This commit is contained in:
root
2026-08-10 12:55:22 +08:00
parent fe06e0861a
commit 41c9b0e14a
9 changed files with 128 additions and 22 deletions

View File

@ -2,12 +2,20 @@ package lua
import (
"encoding/json"
"path/filepath"
"strings"
"testing"
)
// freshAdapterDir returns a path under a temp dir that does not exist yet, so
// VM.Start() treats it as first-run and seeds the bundled adapters.
func freshAdapterDir(t *testing.T) string {
t.Helper()
return filepath.Join(t.TempDir(), "adapters")
}
func TestLoadBundledAdapters(t *testing.T) {
vm := NewVM(t.TempDir())
vm := NewVM(freshAdapterDir(t))
if err := vm.Start(); err != nil {
t.Fatalf("start: %v", err)
}
@ -28,7 +36,7 @@ func TestLoadBundledAdapters(t *testing.T) {
}
func TestTransformRequest(t *testing.T) {
vm := NewVM(t.TempDir())
vm := NewVM(freshAdapterDir(t))
if err := vm.Start(); err != nil {
t.Fatal(err)
}
@ -43,7 +51,7 @@ func TestTransformRequest(t *testing.T) {
}
func TestBuildHeadersFallbackStatic(t *testing.T) {
vm := NewVM(t.TempDir())
vm := NewVM(freshAdapterDir(t))
if err := vm.Start(); err != nil {
t.Fatal(err)
}
@ -58,7 +66,7 @@ func TestBuildHeadersFallbackStatic(t *testing.T) {
}
func TestBuildHeadersCustomHook(t *testing.T) {
vm := NewVM(t.TempDir())
vm := NewVM(freshAdapterDir(t))
if err := vm.Start(); err != nil {
t.Fatal(err)
}
@ -88,7 +96,7 @@ func TestBuildHeadersCustomHook(t *testing.T) {
}
func TestDisableThinkingPassthrough(t *testing.T) {
vm := NewVM(t.TempDir())
vm := NewVM(freshAdapterDir(t))
if err := vm.Start(); err != nil {
t.Fatal(err)
}
@ -130,7 +138,7 @@ func TestDisableThinkingPassthrough(t *testing.T) {
}
func TestMultimodalTransform(t *testing.T) {
vm := NewVM(t.TempDir())
vm := NewVM(freshAdapterDir(t))
if err := vm.Start(); err != nil {
t.Fatal(err)
}