package ollama

import (
	"context"

	ollamaModel "github.com/cloudwego/eino-ext/components/model/ollama"

	"fkteams/agentcore"
	einoruntime "fkteams/agentcore/eino"
	"fkteams/providers/providerkit"
)

// New 创建 Ollama 本地模型的聊天模型
func New(ctx context.Context, cfg *providerkit.Config) (agentcore.ChatModel, error) {
	chatModel, err := ollamaModel.NewChatModel(ctx, &ollamaModel.ChatModelConfig{
		BaseURL:    cfg.BaseURL,
		Model:      cfg.Model,
		HTTPClient: providerkit.HTTPClientWithHeaders(cfg.ExtraHeaders),
	})
	if err != nil {
		return nil, err
	}
	return einoruntime.WrapChatModel(chatModel), nil
}
