MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / Apply

Method Apply

internal/pluginhost/adapters.go:1853–1878  ·  view source on GitHub ↗
(body []byte, config thinking.ThinkingConfig, modelInfo *registry.ModelInfo)

Source from the content-addressed store, hash-verified

1851}
1852
1853func (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
1880func (h *Host) NormalizeRequest(ctx context.Context, from, to sdktranslator.Format, model string, body []byte, stream bool) []byte {
1881 current := bytes.Clone(body)

Callers

nothing calls this directly

Calls 7

isPluginFusedMethod · 0.80
pluginIdentityCurrentMethod · 0.80
fusePluginMethod · 0.80
ApplyThinkingMethod · 0.65
CloneMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected