| package shared |
|
|
| import "ds2api/internal/promptcompat" |
|
|
| func ApplyThinkingInjection(store ConfigReader, stdReq promptcompat.StandardRequest) promptcompat.StandardRequest { |
| if store == nil || !store.ThinkingInjectionEnabled() || !stdReq.Thinking { |
| return stdReq |
| } |
| messages, changed := promptcompat.AppendThinkingInjectionPromptToLatestUser(stdReq.Messages, store.ThinkingInjectionPrompt()) |
| if !changed { |
| return stdReq |
| } |
| finalPrompt, toolNames := promptcompat.BuildOpenAIPrompt(messages, stdReq.ToolsRaw, "", stdReq.ToolChoice, stdReq.Thinking) |
| if len(toolNames) == 0 && len(stdReq.ToolNames) > 0 { |
| toolNames = stdReq.ToolNames |
| } |
| stdReq.Messages = messages |
| stdReq.FinalPrompt = finalPrompt |
| stdReq.ToolNames = toolNames |
| return stdReq |
| } |
|
|