File tree 2 files changed +16
-8
lines changed
refact-server/refact_webgui/webgui 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -251,10 +251,7 @@ def _select_default_model(models: List[str]) -> str:
251
251
completion_models = {}
252
252
for model_name in running_models .get ("completion" , []):
253
253
if model_info := self ._model_assigner .models_db .get (_get_base_model_info (model_name )):
254
- completion_models [model_name ] = {
255
- "n_ctx" : model_info ["T" ],
256
- "supports_scratchpads" : model_info ["supports_scratchpads" ]["completion" ],
257
- }
254
+ completion_models [model_name ] = self ._model_assigner .to_completion_model_record (model_info )
258
255
elif model := available_third_party_models ().get (model_name ):
259
256
completion_models [model_name ] = model .to_completion_model_record ()
260
257
else :
@@ -265,10 +262,7 @@ def _select_default_model(models: List[str]) -> str:
265
262
chat_models = {}
266
263
for model_name in running_models .get ("chat" , []):
267
264
if model_info := self ._model_assigner .models_db .get (_get_base_model_info (model_name )):
268
- chat_models [model_name ] = {
269
- "n_ctx" : model_info ["T" ],
270
- "supports_scratchpads" : model_info ["supports_scratchpads" ]["chat" ],
271
- }
265
+ chat_models [model_name ] = self ._model_assigner .to_chat_model_record (model_info )
272
266
elif model := available_third_party_models ().get (model_name ):
273
267
chat_models [model_name ] = model .to_chat_model_record ()
274
268
else :
Original file line number Diff line number Diff line change @@ -107,6 +107,20 @@ def share_gpu_backends(self) -> Set[str]:
107
107
def models_db (self ) -> Dict [str , Any ]:
108
108
return models_mini_db
109
109
110
+ @staticmethod
111
+ def to_completion_model_record (model_info : Dict [str , Any ]) -> Dict [str , Any ]:
112
+ return {
113
+ "n_ctx" : model_info ["T" ],
114
+ "supports_scratchpads" : model_info ["supports_scratchpads" ]["completion" ],
115
+ }
116
+
117
+ @staticmethod
118
+ def to_chat_model_record (model_info : Dict [str , Any ]) -> Dict [str , Any ]:
119
+ return {
120
+ "n_ctx" : model_info ["T" ],
121
+ "supports_scratchpads" : model_info ["supports_scratchpads" ]["chat" ],
122
+ }
123
+
110
124
def _model_assign_to_groups (self , model_assign : Dict [str , Dict ]) -> List [ModelGroup ]:
111
125
model_groups : List [ModelGroup ] = []
112
126
shared_group = ModelGroup ()
You can’t perform that action at this time.
0 commit comments