mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-15 21:55:09 +08:00
测试DSML
This commit is contained in:
26
internal/httpapi/openai/shared/assistant_toolcalls.go
Normal file
26
internal/httpapi/openai/shared/assistant_toolcalls.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"ds2api/internal/toolcall"
|
||||
)
|
||||
|
||||
func DetectAssistantToolCalls(text, exposedThinking, detectionThinking string, toolNames []string) toolcall.ToolCallParseResult {
|
||||
textParsed := toolcall.ParseStandaloneToolCallsDetailed(text, toolNames)
|
||||
if len(textParsed.Calls) > 0 {
|
||||
return textParsed
|
||||
}
|
||||
if strings.TrimSpace(text) != "" {
|
||||
return textParsed
|
||||
}
|
||||
thinking := detectionThinking
|
||||
if strings.TrimSpace(thinking) == "" {
|
||||
thinking = exposedThinking
|
||||
}
|
||||
thinkingParsed := toolcall.ParseStandaloneToolCallsDetailed(thinking, toolNames)
|
||||
if len(thinkingParsed.Calls) > 0 {
|
||||
return thinkingParsed
|
||||
}
|
||||
return textParsed
|
||||
}
|
||||
Reference in New Issue
Block a user