mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-23 04:28:32 +00:00
fix: migrate Custom OpenAI services to use UUIDs and several other fixes
This commit is contained in:
parent
fdfde4243d
commit
163758a2be
27 changed files with 527 additions and 380 deletions
|
|
@ -58,13 +58,32 @@ public class CustomServiceFormTabbedPane extends JBTabbedPane {
|
|||
|
||||
private void setTableData(JBTable table, Map<String, ?> values) {
|
||||
DefaultTableModel model = (DefaultTableModel) table.getModel();
|
||||
model.setRowCount(0);
|
||||
|
||||
for (var entry : values.entrySet()) {
|
||||
model.addRow(new Object[]{entry.getKey(), entry.getValue()});
|
||||
if (hasTableDataChanged(model, values)) {
|
||||
model.setRowCount(0);
|
||||
for (var entry : values.entrySet()) {
|
||||
model.addRow(new Object[]{entry.getKey(), entry.getValue()});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasTableDataChanged(DefaultTableModel model, Map<String, ?> newValues) {
|
||||
if (model.getRowCount() != newValues.size()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < model.getRowCount(); i++) {
|
||||
String key = (String) model.getValueAt(i, 0);
|
||||
Object value = model.getValueAt(i, 1);
|
||||
|
||||
if (!newValues.containsKey(key) || !java.util.Objects.equals(newValues.get(key), value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private Map<String, Object> getTableData(JBTable table) {
|
||||
var model = (DefaultTableModel) table.getModel();
|
||||
var data = new HashMap<String, Object>();
|
||||
|
|
|
|||
|
|
@ -312,11 +312,11 @@ public class ModelComboBoxAction extends ComboBoxAction {
|
|||
break;
|
||||
case CUSTOM_OPENAI:
|
||||
ModelRegistry.getInstance().getCustomOpenAIModels().stream()
|
||||
.filter(it -> Objects.requireNonNull(modelCode).equals(it.getModel()))
|
||||
.filter(it -> it.getModel().equals(modelCode))
|
||||
.findFirst()
|
||||
.ifPresent(selection -> {
|
||||
templatePresentation.setIcon(Icons.OpenAI);
|
||||
templatePresentation.setText(selection.getModel());
|
||||
templatePresentation.setText(selection.getDisplayName());
|
||||
});
|
||||
break;
|
||||
case ANTHROPIC:
|
||||
|
|
@ -463,7 +463,7 @@ public class ModelComboBoxAction extends ComboBoxAction {
|
|||
Icons.OpenAI,
|
||||
comboBoxPresentation,
|
||||
() -> ApplicationManager.getApplication().getService(ModelSettings.class)
|
||||
.setModel(featureType, model.getName(), CUSTOM_OPENAI));
|
||||
.setModel(featureType, model.getId(), CUSTOM_OPENAI));
|
||||
}
|
||||
|
||||
private AnAction createGoogleModelAction(GoogleModel model, Presentation comboBoxPresentation) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue