-
Notifications
You must be signed in to change notification settings - Fork 23
Feature : update app title connector type and model name #481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sikutisa
merged 20 commits into
aliencube:main
from
jisunchung:feature/371-update-app-title-connector-model
Oct 14, 2025
Merged
Changes from 9 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
37f8761
feat: Add model property to AppSettings and ensure settings are regis…
jisunchung e989f98
feat: Update settings model assignment based on connector type
jisunchung a3d93dc
feat: Enhance ChatHeader to display connector type and model settings
jisunchung fe4e327
feat: Add integration test to verify header displays connector type a…
jisunchung 2e189bf
fix: Correct application title in ChatHeader and update corresponding…
jisunchung 1792e2f
fix: Update ChatHeaderUITests to include connector type validation in…
jisunchung 88a6718
Merge branch 'main' into feature/371-update-app-title-connector-model
jisunchung 4e43a7c
refactor: Remove unused using directives in ChatHeaderUITests
jisunchung b4083fd
feat: Implement AppSettings extension methods for service configuration
jisunchung 74ef31d
fix: Throw exception for unsupported ConnectorType in AppSettingsExte…
jisunchung 8c6f632
test: Add unit tests for AppSettingsExtensions methods
jisunchung f2da8a2
refactor: Rearrange code in ConfigureModelName for clarity and mainta…
jisunchung 36854bf
refactor: Simplify AppSettingsExtensionsTests by consolidating config…
jisunchung 077f86c
fix: Update assertion in AddAppSettings test to use command line mode…
jisunchung 1920ebb
fix: Add null checks for configuration and settings in AddAppSettings…
jisunchung 74e9266
refactor: Separate test cases in AppSettingsExtensionsTests
jisunchung 0ed06be
fix: Add null checks for services, configuration, and settings in Add…
jisunchung 4bba586
fix: Update null argument exception assertions in AddAppSettings test…
jisunchung c3c834a
fix: Replace hardcoded model strings with constants in AddAppSettings…
jisunchung d00daeb
style: Add a blank line for improved readability in AppSettingsExtens…
jisunchung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/OpenChat.PlaygroundApp/Components/Pages/Chat/ChatHeader.razor.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
using Microsoft.AspNetCore.Components; | ||
using OpenChat.PlaygroundApp.Configurations; | ||
|
||
namespace OpenChat.PlaygroundApp.Components.Pages.Chat; | ||
|
||
public partial class ChatHeader : ComponentBase | ||
{ | ||
[Parameter] | ||
public EventCallback OnNewChat { get; set; } | ||
|
||
[Inject] | ||
public required AppSettings Settings { get; set; } | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/OpenChat.PlaygroundApp/Extensions/AppSettingsExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using OpenChat.PlaygroundApp.Configurations; | ||
using OpenChat.PlaygroundApp.Connectors; | ||
|
||
namespace OpenChat.PlaygroundApp.Extensions; | ||
|
||
/// <summary> | ||
/// This represents the extension entity for handling AppSettings configuration. | ||
/// </summary> | ||
public static class AppSettingsExtensions | ||
{ | ||
/// <summary> | ||
/// Configures and adds AppSettings to the service collection with model name populated. | ||
/// </summary> | ||
/// <param name="services">The <see cref="IServiceCollection"/> instance.</param> | ||
/// <param name="configuration">The <see cref="IConfiguration"/> instance.</param> | ||
/// <param name="settings">The <see cref="AppSettings"/> instance.</param> | ||
/// <returns>Returns the modified <see cref="IServiceCollection"/> instance.</returns> | ||
public static IServiceCollection AddAppSettings(this IServiceCollection services, IConfiguration configuration, AppSettings settings) | ||
{ | ||
ConfigureModelName(configuration, settings); | ||
services.AddSingleton(settings); | ||
|
||
return services; | ||
} | ||
|
||
/// <summary> | ||
/// Configures the model name in AppSettings based on the connector type. | ||
/// </summary> | ||
/// <param name="configuration">The <see cref="IConfiguration"/> instance.</param> | ||
/// <param name="settings">The <see cref="AppSettings"/> instance.</param> | ||
private static void ConfigureModelName(IConfiguration configuration, AppSettings settings) | ||
{ | ||
var section = configuration.GetSection(settings.ConnectorType.ToString()); | ||
|
||
string? modelFromSettings = settings.ConnectorType switch | ||
{ | ||
ConnectorType.AzureAIFoundry => settings.AzureAIFoundry?.DeploymentName, | ||
ConnectorType.FoundryLocal => settings.FoundryLocal?.Alias, | ||
ConnectorType.GitHubModels => settings.GitHubModels?.Model, | ||
ConnectorType.OpenAI => settings.OpenAI?.Model, | ||
ConnectorType.HuggingFace => settings.HuggingFace?.Model, | ||
ConnectorType.Anthropic => settings.Anthropic?.Model, | ||
ConnectorType.LG => settings.LG?.Model, | ||
_ => null | ||
}; | ||
|
||
settings.Model = modelFromSettings ?? settings.ConnectorType switch | ||
{ | ||
ConnectorType.AzureAIFoundry => section.GetValue<string>("DeploymentName"), | ||
ConnectorType.FoundryLocal => section.GetValue<string>("Alias"), | ||
_ => section.GetValue<string>("Model") | ||
}; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.