Skip to content

Commit

Permalink
model config fix (#4344)
Browse files Browse the repository at this point in the history
Co-authored-by: Cole Blanchard <[email protected]>
  • Loading branch information
blanchco and Cole Blanchard authored Aug 2, 2024
1 parent d584f9b commit 290ea77
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ watch(
if (modelId) {
let configs = await getModelConfigurationsForModel(modelId);
if (!configs[0].id) {
if (!configs[0]?.id) {
const model = await getModel(modelId);
if (model) await postAsConfiguredModel(model); // Create a model configuration if it does not exist
configs = await getModelConfigurationsForModel(modelId);
}
// Auto append output
if (configs[0].id) {
if (configs[0]?.id) {
const config = configs[0];
state.transientModelConfig = config;
emit('update-state', state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,10 @@ ResponseEntity<List<ModelConfiguration>> getModelConfigurationsForModelId(

try {
final List<ModelConfiguration> modelConfigurations =
modelConfigRepository.findByModelIdAndDeletedOnIsNullAndTemporaryFalse(id, PageRequest.of(page, pageSize));
modelConfigRepository.findByModelIdAndDeletedOnIsNullAndTemporaryFalseOrderByCreatedOnAsc(
id,
PageRequest.of(page, pageSize)
);

return ResponseEntity.ok(modelConfigurations);
} catch (final Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@

@Repository
public interface ModelConfigRepository extends PSCrudSoftDeleteRepository<ModelConfiguration, UUID> {
List<ModelConfiguration> findByModelIdAndDeletedOnIsNullAndTemporaryFalse(UUID modelId, Pageable pageable);
List<ModelConfiguration> findByModelIdAndDeletedOnIsNullAndTemporaryFalseOrderByCreatedOnAsc(
UUID modelId,
Pageable pageable
);
}

0 comments on commit 290ea77

Please sign in to comment.