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

Method nextModelPoolOffset

sdk/cliproxy/auth/conductor.go:1046–1068  ·  view source on GitHub ↗
(key string, size int)

Source from the content-addressed store, hash-verified

1044}
1045
1046func (m *Manager) nextModelPoolOffset(key string, size int) int {
1047 if m == nil || size <= 1 {
1048 return 0
1049 }
1050 key = strings.TrimSpace(key)
1051 if key == "" {
1052 return 0
1053 }
1054 m.mu.Lock()
1055 defer m.mu.Unlock()
1056 if m.modelPoolOffsets == nil {
1057 m.modelPoolOffsets = make(map[string]int)
1058 }
1059 offset := m.modelPoolOffsets[key]
1060 if offset >= 2_147_483_640 {
1061 offset = 0
1062 }
1063 m.modelPoolOffsets[key] = offset + 1
1064 if size <= 0 {
1065 return 0
1066 }
1067 return offset % size
1068}
1069
1070func rotateStrings(values []string, offset int) []string {
1071 if len(values) <= 1 {

Calls

no outgoing calls

Tested by

no test coverage detected