mirror of
				https://github.com/MindWorkAI/AI-Studio.git
				synced 2025-11-04 05:20:21 +00:00 
			
		
		
		
	Ensure that available data sources and embeddings are loaded when init
This commit is contained in:
		
							parent
							
								
									bd768decb5
								
							
						
					
					
						commit
						7aba4e8d0a
					
				@ -20,6 +20,17 @@ public partial class SettingsPanelDataSources : SettingsPanelBase
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
    [Parameter]
 | 
					    [Parameter]
 | 
				
			||||||
    public Func<IReadOnlyList<ConfigurationSelectData<string>>> AvailableEmbeddingsFunc { get; set; } = () => [];
 | 
					    public Func<IReadOnlyList<ConfigurationSelectData<string>>> AvailableEmbeddingsFunc { get; set; } = () => [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    #region Overrides of ComponentBase
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected override async Task OnInitializedAsync()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        await this.UpdateDataSources();
 | 
				
			||||||
 | 
					        await base.OnInitializedAsync();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private string GetEmbeddingName(IDataSource dataSource)
 | 
					    private string GetEmbeddingName(IDataSource dataSource)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if(dataSource is IInternalDataSource internalDataSource)
 | 
					        if(dataSource is IInternalDataSource internalDataSource)
 | 
				
			||||||
 | 
				
			|||||||
@ -22,6 +22,16 @@ public partial class SettingsPanelEmbeddings : SettingsPanelBase
 | 
				
			|||||||
        return modelName.Length > MAX_LENGTH ? "[...] " + modelName[^Math.Min(MAX_LENGTH, modelName.Length)..] : modelName;
 | 
					        return modelName.Length > MAX_LENGTH ? "[...] " + modelName[^Math.Min(MAX_LENGTH, modelName.Length)..] : modelName;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    #region Overrides of ComponentBase
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected override async Task OnInitializedAsync()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        await this.UpdateEmbeddingProviders();
 | 
				
			||||||
 | 
					        await base.OnInitializedAsync();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private async Task AddEmbeddingProvider()
 | 
					    private async Task AddEmbeddingProvider()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        var dialogParameters = new DialogParameters<EmbeddingProviderDialog>
 | 
					        var dialogParameters = new DialogParameters<EmbeddingProviderDialog>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user