mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-02-11 22:44:59 -05:00
## CHANGES - Move domain types from common to domain package - Move utility functions from common to util package - Update all import statements across codebase - Reorganize OAuth storage functionality into util package - Move file management functions to domain package - Update test files to use new package structure - Maintain backward compatibility for existing functionality
28 lines
800 B
Go
28 lines
800 B
Go
package domain
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/danielmiessler/fabric/internal/chat"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNormalizeMessages(t *testing.T) {
|
|
msgs := []*chat.ChatCompletionMessage{
|
|
{Role: chat.ChatMessageRoleUser, Content: "Hello"},
|
|
{Role: chat.ChatMessageRoleAssistant, Content: "Hi there!"},
|
|
{Role: chat.ChatMessageRoleUser, Content: ""},
|
|
{Role: chat.ChatMessageRoleUser, Content: ""},
|
|
{Role: chat.ChatMessageRoleUser, Content: "How are you?"},
|
|
}
|
|
|
|
expected := []*chat.ChatCompletionMessage{
|
|
{Role: chat.ChatMessageRoleUser, Content: "Hello"},
|
|
{Role: chat.ChatMessageRoleAssistant, Content: "Hi there!"},
|
|
{Role: chat.ChatMessageRoleUser, Content: "How are you?"},
|
|
}
|
|
|
|
actual := NormalizeMessages(msgs, "default")
|
|
assert.Equal(t, expected, actual)
|
|
}
|