MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / Set

Method Set

module/system/iml.go:36–56  ·  view source on GitHub ↗
(ctx context.Context, input *system_dto.InputSetting)

Source from the content-addressed store, hash-verified

34}
35
36func (i *imlSettingModule) Set(ctx context.Context, input *system_dto.InputSetting) error {
37 err := input.Validate()
38 if err != nil {
39 return err
40 }
41
42 return i.transaction.Transaction(ctx, func(ctx context.Context) error {
43 keyMap := system_dto.ToKeyMap(input)
44 userId := utils.UserId(ctx)
45 for k, v := range keyMap {
46 err = i.settingService.Set(ctx, k, v, userId)
47 if err != nil {
48 return err
49 }
50 }
51 if input.OllamaAddress != nil {
52 ai_provider_local.ResetLocalAddress(*input.OllamaAddress)
53 }
54 return nil
55 })
56}
57
58func (i *imlSettingModule) OnInit() {
59 register.Handle(func(v server.Server) {

Callers

nothing calls this directly

Calls 2

SetMethod · 0.65
ValidateMethod · 0.45

Tested by

no test coverage detected