MCPcopy Create free account
hub / github.com/astercloud/aster / ExecuteModelCall

Method ExecuteModelCall

pkg/middleware/stack.go:42–58  ·  view source on GitHub ↗

ExecuteModelCall 执行模型调用(通过中间件栈)

(
	ctx context.Context,
	req *ModelRequest,
	finalHandler ModelCallHandler,
)

Source from the content-addressed store, hash-verified

40
41// ExecuteModelCall 执行模型调用(通过中间件栈)
42func (s *Stack) ExecuteModelCall(
43 ctx context.Context,
44 req *ModelRequest,
45 finalHandler ModelCallHandler,
46) (*ModelResponse, error) {
47 // 构建中间件链
48 handler := finalHandler
49 for i := len(s.middlewares) - 1; i >= 0; i-- {
50 m := s.middlewares[i]
51 currentHandler := handler
52 handler = func(ctx context.Context, req *ModelRequest) (*ModelResponse, error) {
53 return m.WrapModelCall(ctx, req, currentHandler)
54 }
55 }
56
57 return handler(ctx, req)
58}
59
60// ExecuteToolCall 执行工具调用(通过中间件栈)
61func (s *Stack) ExecuteToolCall(

Callers 2

runModelStepStreamingMethod · 0.80
runModelStepMethod · 0.80

Calls 2

handlerFunction · 0.85
WrapModelCallMethod · 0.65

Tested by

no test coverage detected