Implement remaining code review suggestions
- Add graceful shutdown with SIGTERM/SIGINT handling\n- Make model list configurable via config.yaml\n- Remove sensitive data from debug logs (log sizes instead of full bodies)\n- Handle array format in system messages (both string and []interface{})\n- Update config.yaml with new models structure
This commit is contained in:
parent
f65ad6b189
commit
cea246da83
5 changed files with 60 additions and 12 deletions
12
converter.go
12
converter.go
|
|
@ -53,8 +53,18 @@ func extractSystemMessage(messages []Message) (string, []Message) {
|
|||
|
||||
for _, msg := range messages {
|
||||
if msg.Role == "system" {
|
||||
if content, ok := msg.Content.(string); ok {
|
||||
switch content := msg.Content.(type) {
|
||||
case string:
|
||||
systemParts = append(systemParts, content)
|
||||
case []interface{}:
|
||||
// Extract text from content array
|
||||
for _, part := range content {
|
||||
if partMap, ok := part.(map[string]interface{}); ok {
|
||||
if text, ok := partMap["text"].(string); ok {
|
||||
systemParts = append(systemParts, text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rest = append(rest, msg)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue