enable prealloc
Find slice declarations that could potentially be pre-allocated. Signed-off-by: Kai Xia <kaix+github@fastmail.com>
This commit is contained in:
parent
09cf8efde6
commit
4e6589d51f
3 changed files with 2 additions and 3 deletions
|
|
@ -53,7 +53,6 @@ linters:
|
||||||
- nilnil
|
- nilnil
|
||||||
- paralleltest
|
- paralleltest
|
||||||
- perfsprint
|
- perfsprint
|
||||||
- prealloc
|
|
||||||
- predeclared
|
- predeclared
|
||||||
- revive
|
- revive
|
||||||
- staticcheck
|
- staticcheck
|
||||||
|
|
|
||||||
|
|
@ -800,7 +800,7 @@ func (al *AgentLoop) forceCompression(agent *AgentInstance, sessionKey string) {
|
||||||
droppedCount := mid
|
droppedCount := mid
|
||||||
keptConversation := conversation[mid:]
|
keptConversation := conversation[mid:]
|
||||||
|
|
||||||
newHistory := make([]providers.Message, 0)
|
newHistory := make([]providers.Message, 0, 1+len(keptConversation)+1)
|
||||||
|
|
||||||
// Append compression note to the original system prompt instead of adding a new system message
|
// Append compression note to the original system prompt instead of adding a new system message
|
||||||
// This avoids having two consecutive system messages which some APIs (like Zhipu) reject
|
// This avoids having two consecutive system messages which some APIs (like Zhipu) reject
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ func formatComponent(component string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func formatFields(fields map[string]any) string {
|
func formatFields(fields map[string]any) string {
|
||||||
var parts []string
|
parts := make([]string, 0, len(fields))
|
||||||
for k, v := range fields {
|
for k, v := range fields {
|
||||||
parts = append(parts, fmt.Sprintf("%s=%v", k, v))
|
parts = append(parts, fmt.Sprintf("%s=%v", k, v))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue