feat(*): 创作工作台 - 完善媒体上传预览与连线交互并修复任务章节及日志筛选
This commit is contained in:
1 parent
95b004ec0f
commit
068a8daea6
56 files changed
+3316
-274
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestChapterAssetsPromptContract(t *testing.T) {
|
||||
if !json.Valid([]byte(chapterAssetsJSONSchema)) {
|
||||
t.Fatal("invalid chapter assets schema")
|
||||
}
|
||||
for _, tc := range []struct {
|
||||
text string
|
||||
valid bool
|
||||
}{
|
||||
{`{"characters":[],"scenes":[{"name":"车站","description":"空旷站台","prompt":"夜间站台"}],"props":[{"name":"信封","description":"牛皮纸信封","prompt":"信封特写"}]}`, true},
|
||||
{`{"characters":[],"scenes":[],"props":[]}`, true},
|
||||
{`{"characters":[]}`, false},
|
||||
{`{"characters":[],"scenes":[{"name":"车站"}],"props":[]}`, false},
|
||||
{`{"characters":[{"name":"张三"}],"scenes":[],"props":[]}`, false},
|
||||
} {
|
||||
err := validatePromptTemplateResult(promptOperationChapterAssetsExtract, map[string]interface{}{"text": tc.text})
|
||||
if (err == nil) != tc.valid {
|
||||
t.Fatalf("valid=%v err=%v", tc.valid, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user