Enha: avoid recursion in llm calls

This commit is contained in:
Grail Finder
2026-01-31 12:57:53 +03:00
parent fa192a2624
commit 3a11210f52
5 changed files with 132 additions and 60 deletions

View File

@@ -116,9 +116,9 @@ func (m RoleMsg) MarshalJSON() ([]byte, error) {
} else {
// Use simple content format
aux := struct {
Role string `json:"role"`
Content string `json:"content"`
ToolCallID string `json:"tool_call_id,omitempty"`
Role string `json:"role"`
Content string `json:"content"`
ToolCallID string `json:"tool_call_id,omitempty"`
KnownTo []string `json:"known_to,omitempty"`
}{
Role: m.Role,
@@ -150,9 +150,9 @@ func (m *RoleMsg) UnmarshalJSON(data []byte) error {
// Otherwise, unmarshal as simple content format
var simple struct {
Role string `json:"role"`
Content string `json:"content"`
ToolCallID string `json:"tool_call_id,omitempty"`
Role string `json:"role"`
Content string `json:"content"`
ToolCallID string `json:"tool_call_id,omitempty"`
KnownTo []string `json:"known_to,omitempty"`
}
if err := json.Unmarshal(data, &simple); err != nil {
@@ -540,3 +540,10 @@ func (lcp *LCPModels) ListModels() []string {
}
return resp
}
type ChatRoundReq struct {
UserMsg string
Role string
Regen bool
Resume bool
}