mirror of
				https://github.com/MindWorkAI/AI-Studio.git
				synced 2025-11-04 15:20:20 +00:00 
			
		
		
		
	Added configuration for writing code into the file system
This commit is contained in:
		
							parent
							
								
									3f22380410
								
							
						
					
					
						commit
						170cda428c
					
				@ -326,3 +326,16 @@ else
 | 
				
			|||||||
</MudText>
 | 
					</MudText>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
 | 
					<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<MudText Typo="Typo.h4" Class="mt-9 mb-1">
 | 
				
			||||||
 | 
					    Write code to file system
 | 
				
			||||||
 | 
					</MudText>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<MudText Typo="Typo.body1" Class="mb-2">
 | 
				
			||||||
 | 
					    AI Studio can save the generated code to the file system. You can select a base folder for this. AI Studio ensures that no files are created
 | 
				
			||||||
 | 
					    outside of this base folder. Furthermore, we recommend that you create a Git repository in this folder. This way, you can see what changes the
 | 
				
			||||||
 | 
					    AI has made in which files.
 | 
				
			||||||
 | 
					</MudText>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<MudTextSwitch Label="Should we write the generated code to the file system?" Disabled="@this.IsNoneERIServerSelected" @bind-Value="@this.writeToFilesystem" LabelOn="Yes, please write or update all generated code to the file system" LabelOff="No, just show me the code" />
 | 
				
			||||||
 | 
					<SelectDirectory Label="Base directory where to write the code" @bind-Directory="@this.baseDirectory" Disabled="@(this.IsNoneERIServerSelected || !this.writeToFilesystem)" DirectoryDialogTitle="Select the target directory for the ERI server"/>
 | 
				
			||||||
 | 
				
			|||||||
@ -333,6 +333,8 @@ public partial class AssistantERI : AssistantBaseCore
 | 
				
			|||||||
            this.embeddings = new();
 | 
					            this.embeddings = new();
 | 
				
			||||||
            this.retrievalProcesses = new();
 | 
					            this.retrievalProcesses = new();
 | 
				
			||||||
            this.additionalLibraries = string.Empty;
 | 
					            this.additionalLibraries = string.Empty;
 | 
				
			||||||
 | 
					            this.writeToFilesystem = false;
 | 
				
			||||||
 | 
					            this.baseDirectory = string.Empty;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@ -362,6 +364,8 @@ public partial class AssistantERI : AssistantBaseCore
 | 
				
			|||||||
            this.embeddings = this.selectedERIServer.EmbeddingInfos;
 | 
					            this.embeddings = this.selectedERIServer.EmbeddingInfos;
 | 
				
			||||||
            this.retrievalProcesses = this.selectedERIServer.RetrievalInfos;
 | 
					            this.retrievalProcesses = this.selectedERIServer.RetrievalInfos;
 | 
				
			||||||
            this.additionalLibraries = this.selectedERIServer.AdditionalLibraries;
 | 
					            this.additionalLibraries = this.selectedERIServer.AdditionalLibraries;
 | 
				
			||||||
 | 
					            this.writeToFilesystem = this.selectedERIServer.WriteToFilesystem;
 | 
				
			||||||
 | 
					            this.baseDirectory = this.selectedERIServer.BaseDirectory;
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
@ -416,6 +420,8 @@ public partial class AssistantERI : AssistantBaseCore
 | 
				
			|||||||
        this.selectedERIServer.EmbeddingInfos = this.embeddings;
 | 
					        this.selectedERIServer.EmbeddingInfos = this.embeddings;
 | 
				
			||||||
        this.selectedERIServer.RetrievalInfos = this.retrievalProcesses;
 | 
					        this.selectedERIServer.RetrievalInfos = this.retrievalProcesses;
 | 
				
			||||||
        this.selectedERIServer.AdditionalLibraries = this.additionalLibraries;
 | 
					        this.selectedERIServer.AdditionalLibraries = this.additionalLibraries;
 | 
				
			||||||
 | 
					        this.selectedERIServer.WriteToFilesystem = this.writeToFilesystem;
 | 
				
			||||||
 | 
					        this.selectedERIServer.BaseDirectory = this.baseDirectory;
 | 
				
			||||||
        await this.SettingsManager.StoreSettings();
 | 
					        await this.SettingsManager.StoreSettings();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -440,6 +446,8 @@ public partial class AssistantERI : AssistantBaseCore
 | 
				
			|||||||
    private List<EmbeddingInfo> embeddings = new();
 | 
					    private List<EmbeddingInfo> embeddings = new();
 | 
				
			||||||
    private List<RetrievalInfo> retrievalProcesses = new();
 | 
					    private List<RetrievalInfo> retrievalProcesses = new();
 | 
				
			||||||
    private string additionalLibraries = string.Empty;
 | 
					    private string additionalLibraries = string.Empty;
 | 
				
			||||||
 | 
					    private bool writeToFilesystem;
 | 
				
			||||||
 | 
					    private string baseDirectory = string.Empty;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private bool AreServerPresetsBlocked => !this.SettingsManager.ConfigurationData.ERI.PreselectOptions;
 | 
					    private bool AreServerPresetsBlocked => !this.SettingsManager.ConfigurationData.ERI.PreselectOptions;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
				
			|||||||
@ -95,4 +95,14 @@ public sealed class DataERIServer
 | 
				
			|||||||
    /// Do you want to preselect any additional libraries?
 | 
					    /// Do you want to preselect any additional libraries?
 | 
				
			||||||
    /// </summary>
 | 
					    /// </summary>
 | 
				
			||||||
    public string AdditionalLibraries { get; set; } = string.Empty;
 | 
					    public string AdditionalLibraries { get; set; } = string.Empty;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// Do you want to write all generated code to the filesystem?
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
 | 
					    public bool WriteToFilesystem { get; set; } = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// The base directory where to write the generated code to.
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
 | 
					    public string BaseDirectory { get; set; } = string.Empty;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user