(body []byte, config thinking.ThinkingConfig, modelInfo *registry.ModelInfo)
| 1851 | } |
| 1852 | |
| 1853 | func (a *thinkingAdapter) Apply(body []byte, config thinking.ThinkingConfig, modelInfo *registry.ModelInfo) (out []byte, err error) { |
| 1854 | if a == nil || a.applier == nil || a.host == nil || a.host.isPluginFused(a.pluginID) || !a.host.pluginIdentityCurrent(a.pluginID, a.path, a.version) { |
| 1855 | return bytes.Clone(body), nil |
| 1856 | } |
| 1857 | defer func() { |
| 1858 | if recovered := recover(); recovered != nil { |
| 1859 | a.host.fusePlugin(a.pluginID, "ThinkingApplier.ApplyThinking", recovered) |
| 1860 | out = bytes.Clone(body) |
| 1861 | err = nil |
| 1862 | } |
| 1863 | }() |
| 1864 | resp, errApply := a.applier.ApplyThinking(context.Background(), pluginapi.ThinkingApplyRequest{ |
| 1865 | Provider: a.provider, |
| 1866 | Model: registryModelInfoToPluginModelInfo(modelInfo), |
| 1867 | Config: pluginapi.ThinkingConfig{ |
| 1868 | Mode: config.Mode.String(), |
| 1869 | Budget: config.Budget, |
| 1870 | Level: string(config.Level), |
| 1871 | }, |
| 1872 | Body: bytes.Clone(body), |
| 1873 | }) |
| 1874 | if errApply != nil || len(resp.Body) == 0 { |
| 1875 | return bytes.Clone(body), nil |
| 1876 | } |
| 1877 | return bytes.Clone(resp.Body), nil |
| 1878 | } |
| 1879 | |
| 1880 | func (h *Host) NormalizeRequest(ctx context.Context, from, to sdktranslator.Format, model string, body []byte, stream bool) []byte { |
| 1881 | current := bytes.Clone(body) |
nothing calls this directly
no test coverage detected