使用轮询策略获取一个可用的实例
(self)
| 169 | |
| 170 | |
| 171 | def get_available_instance(self): |
| 172 | """使用轮询策略获取一个可用的实例""" |
| 173 | with self.lock: |
| 174 | instance = self.instances[self.current_instance] |
| 175 | self.current_instance = (self.current_instance + 1) % len(self.instances) |
| 176 | return instance["port"] # 返回端口 |
| 177 | |
| 178 | def generate_text(self, prompt,system_prompt=None, history_messages=[], **kwargs): |
| 179 | """发送请求到选择的实例""" |
no outgoing calls
no test coverage detected