Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Open Chat Playground (OCP) is a web UI that is able to connect virtually any LLM
- [Use Azure AI Foundry](./docs/azure-ai-foundry.md#run-in-local-container)
- [Use GitHub Models](./docs/github-models.md#run-in-local-container)
- [Use Docker Model Runner](./docs/docker-model-runner.md#run-in-local-container)
- ~~Use Foundry Local~~ 👉 NOT SUPPORTED
- [Use Foundry Local](./docs/foundry-local.md#run-in-local-container)
- [Use Hugging Face](./docs/hugging-face.md#run-in-local-container)
- [Use Ollama](./docs/ollama.md#run-on-local-container)
- [Use LG](./docs/lg.md#run-in-local-container)
Expand Down
122 changes: 121 additions & 1 deletion docs/foundry-local.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,124 @@ This page describes how to run OpenChat Playground (OCP) with Foundry Local mode
--alias qwen2.5-7b
```

1. Open your web browser, navigate to `http://localhost:5280`, and enter prompts.
1. Open your web browser, navigate to `http://localhost:5280`, and enter prompts.

## Run in local container

1. Make sure the Foundry Local server is up and running.

```bash
foundry service start
```

1. Download the Foundry Local model. The default model OCP uses is `Phi-4-mini-instruct-generic-cpu:4`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우선은 phi-4-mini로 모델을 받고, 가이드 문서 하단에서 foundry service list command를 통해서 Model ID를 가져오는 흐름으로 문서를 작성했습니다.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우리는 ModelId를 사용하지 않습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Foundry Local SDK 예제 코드 에서도
var chatClient = client.GetChatClient(model?.ModelId); ModelId를 사용하고 있습니다.

만약 이와 같이 Alias를 사용하면, client.GetChatClient("phi-4-mini") 아래와 같은 에러가 발생합니다.

System.ClientModel.ClientResultException: Service request failed.
Status: 400 (Bad Request)

   at OpenAI.ClientPipelineExtensions.ProcessMessageAsync(ClientPipeline pipeline, PipelineMessage message, RequestOptions options)
   at OpenAI.Chat.ChatClient.CompleteChatAsync(BinaryContent content, RequestOptions options)
   at OpenAI.Chat.ChatClient.<>c__DisplayClass19_0.<<CompleteChatStreamingAsync>b__0>d.MoveNext()

```bash
foundry model download Phi-4-mini-instruct-generic-cpu:4
```

Alternatively, if you want to run with a different model, say `qwen2.5-7b-instruct-generic-cpu:3`, other than the default one, download it first by running the following command.

```bash
foundry model download qwen2.5-7b-instruct-generic-cpu:3
```

Make sure to follow the model MUST be selected from the CLI output of `foundry model list`.

1. Load the Foundry Local model. The default model OCP uses is `Phi-4-mini-instruct-generic-cpu:4`.

```bash
foundry model load Phi-4-mini-instruct-generic-cpu:4
```

Alternatively, if you want to run with a different model, say `qwen2.5-7b-instruct-generic-cpu:3`, other than the default one, download it first by running the following command.

```bash
foundry model load qwen2.5-7b-instruct-generic-cpu:3
```

1. Make sure you are at the repository root.

```bash
cd $REPOSITORY_ROOT
```

1. Build a container.

```bash
docker build -f Dockerfile -t openchat-playground:latest .
```

1. Run the app. The default model OCP uses is `Phi-4-mini-instruct-generic-cpu:4`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Model ID를 가져다가, Alias 파라미터로 넘겨줘야 하는 느낌으로 작성했습니다.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우리는 ModelId를 사용하지 않습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client.GetChatClient 메서드에는 파라미터로 model id를 받습니다만,
FoundryLocalManager을 사용하지 않고서는 Alais만으로 ModeId를 가져올 수가 없습니다.

```bash
# bash/zsh - from locally built container
docker run -i --rm -p 8080:8080 openchat-playground:latest \
--connector-type FoundryLocal \
--endpoint http://host.docker.internal:55438/v1 \
--disable-foundrylocal-manager
```

```powershell
# PowerShell - from locally built container
docker run -i --rm -p 8080:8080 openchat-playground:latest `
--connector-type FoundryLocal `
--endpoint http://host.docker.internal:55438/v1 `
--disable-foundrylocal-manager
```

```bash
# bash/zsh - from GitHub Container Registry
docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest \
--connector-type FoundryLocal \
--endpoint http://host.docker.internal:55438/v1 \
--disable-foundrylocal-manager
```

```powershell
# PowerShell - from GitHub Container Registry
docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest `
--connector-type FoundryLocal `
--endpoint http://host.docker.internal:55438/v1 `
--disable-foundrylocal-manager
```

Alternatively, if you want to run with a different model, say `qwen2.5-7b-instruct-generic-cpu:3`, make sure you've already downloaded the model by running the `foundry model load qwen2.5-7b-instruct-generic-cpu:3` command.

```bash
# bash/zsh - from locally built container
docker run -i --rm -p 8080:8080 openchat-playground:latest \
--connector-type FoundryLocal \
--endpoint http://host.docker.internal:55438/v1 \
--model-id qwen2.5-7b-instruct-generic-cpu:3 \
--disable-foundrylocal-manager
```

```powershell
# PowerShell - from locally built container
docker run -i --rm -p 8080:8080 openchat-playground:latest `
--connector-type FoundryLocal `
--endpoint http://host.docker.internal:55438/v1 `
--model-id qwen2.5-7b-instruct-generic-cpu:3 `
--disable-foundrylocal-manager
```

```bash
# bash/zsh - from GitHub Container Registry
docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest \
--connector-type FoundryLocal \
--endpoint http://host.docker.internal:55438/v1 \
--model-id qwen2.5-7b-instruct-generic-cpu:3 \
--disable-foundrylocal-manager
```

```powershell
# PowerShell - from GitHub Container Registry
docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest `
--connector-type FoundryLocal `
--endpoint http://host.docker.internal:55438/v1 `
--model-id qwen2.5-7b-instruct-generic-cpu:3 `
--disable-foundrylocal-manager
```

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, if you want to run with a different model, say qwen2.5-7b, other than the default one, download it first by running the following command.

다른 모델 사용에 대한 예시에도 --alias {{Model ID}} 이거 말고, 생각이 안나서... 우선은 제외 했습니다..!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 우리는 ModelId를 사용하지 않습니다.
  • 엔드포인트에 v1이 붙는 건 어떻게 확인하셨나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우리는 ModelId를 사용하지 않습니다.

client.GetChatClient 메서드에는 파라미터로 model id를 받습니다만,
FoundryLocalManager을 사용하지 않고서는 Alais만으로 ModeId를 가져올 수가 없습니다.

엔드포인트에 v1이 붙는 건 어떻게 확인하셨나요?

FoundryLocalManager.cs에 이와 같이 있습니다.
public Uri Endpoint => new Uri(ServiceUri, "/v1");

1. Open your web browser, navigate to `http://localhost:8080`, and enter prompts.
15 changes: 13 additions & 2 deletions src/OpenChat.PlaygroundApp/Abstractions/ArgumentOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ private static readonly (ConnectorType ConnectorType, string Argument, bool IsSw
(ConnectorType.DockerModelRunner, ArgumentOptionConstants.DockerModelRunner.Model, false),
// Foundry Local
(ConnectorType.FoundryLocal, ArgumentOptionConstants.FoundryLocal.Alias, false),
(ConnectorType.FoundryLocal, ArgumentOptionConstants.FoundryLocal.Endpoint, false),
(ConnectorType.FoundryLocal, ArgumentOptionConstants.FoundryLocal.ModelId, false),
(ConnectorType.FoundryLocal, ArgumentOptionConstants.FoundryLocal.DisableFoundryLocalManager, false),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DisableFoundryLocalManager 값은 스위치입니다. 따라서 false가 아니라 true가 되어야 합니다.

// Hugging Face
(ConnectorType.HuggingFace, ArgumentOptionConstants.HuggingFace.BaseUrl, false),
(ConnectorType.HuggingFace, ArgumentOptionConstants.HuggingFace.Model, false),
Expand Down Expand Up @@ -213,8 +216,13 @@ public static AppSettings Parse(IConfiguration config, string[] args)
case FoundryLocalArgumentOptions foundryLocal:
settings.FoundryLocal ??= new FoundryLocalSettings();
settings.FoundryLocal.Alias = foundryLocal.Alias ?? settings.FoundryLocal.Alias;
settings.FoundryLocal.Endpoint = foundryLocal.Endpoint ?? settings.FoundryLocal.Endpoint;
settings.FoundryLocal.ModelId = foundryLocal.ModelId ?? settings.FoundryLocal.ModelId;
settings.FoundryLocal.DisableFoundryLocalManager = foundryLocal.DisableFoundryLocalManager;

settings.Model = foundryLocal.Alias ?? settings.FoundryLocal.Alias;
settings.Model = foundryLocal.DisableFoundryLocalManager
? foundryLocal.ModelId ?? settings.FoundryLocal.ModelId
: foundryLocal.Alias ?? settings.FoundryLocal.Alias;
break;

case HuggingFaceArgumentOptions huggingFace:
Expand Down Expand Up @@ -419,12 +427,15 @@ private static void DisplayHelpForDockerModelRunner()

private static void DisplayHelpForFoundryLocal()
{
// --model The OpenAI model name. Default to 'gpt-4.1-mini'
var foregroundColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.DarkYellow;
Console.WriteLine(" ** Foundry Local: **");
Console.ForegroundColor = foregroundColor;

Console.WriteLine(" TBD");
Console.WriteLine($" {ArgumentOptionConstants.FoundryLocal.Alias} The alias. Default to 'phi-4-mini'");
Console.WriteLine($" {ArgumentOptionConstants.FoundryLocal.Endpoint} The endpoint URL. Default to 'http://127.0.0.1:55438/v1'");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 이 값은 DisableFoundryLocalManager 값이 true 일 경우에만 필수입니다. 그 이외의 경우에는 필수가 아니예요.
  • BaseUrl 이 맞을까요, Endpoint가 맞을까요?
  • 만약 Endpoint 라고 한다면 맨 뒤에 v1을 붙이는게 맞을까요, 아니면 커넥터를 생성하는 과정에서 동적으로 붙이는 게 맞을까요?

Copy link
Contributor Author

@name-of-okja name-of-okja Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BaseUrl 이 맞을까요, Endpoint가 맞을까요?

'http://127.0.0.1:55438/v1' 와 같이 v1 이 붙으면 Endpoint이고,
'http://127.0.0.1:55438' 와 같이 path가 없으면 BaseUrl이 맞을 것 같습니다.

만약 Endpoint 라고 한다면 맨 뒤에 v1을 붙이는게 맞을까요, 아니면 커넥터를 생성하는 과정에서 동적으로 붙이는 게 맞을까요?

Endpoint은 바뀔 수가 있으니
FoundryLocalManager.cs 와 같이 argument로 받을 때는 BaseUrl로 http://127.0.0.1:55438 이렇게만 받고, 커넥터를 생성하는 과정에서 동적으로 붙이는 게 맞는 것 같습니다!

BaseUrl로 수정 하겠습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 값은 DisableFoundryLocalManager 값이 true 일 경우에만 필수입니다. 그 이외의 경우에는 필수가 아니예요.

이와 같은 느낌은 어떨까요?
image

  ** Foundry Local: **
  --disable-foundrylocal-manager
                       Disable the built-in Foundry local manager.
                       When this flag is set, you must specify '--base-url'.
    --base-url         The base URL. Default to 'http://localhost:50594'

  --alias              The alias. Default to 'phi-4-mini'

Console.WriteLine($" {ArgumentOptionConstants.FoundryLocal.ModelId} The model ID. Default to 'Phi-4-mini-instruct-generic-cpu:4'");
Console.WriteLine();
}

Expand Down
16 changes: 16 additions & 0 deletions src/OpenChat.PlaygroundApp/Configurations/FoundryLocalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,20 @@ public class FoundryLocalSettings : LanguageModelSettings
/// Gets or sets the alias of FoundryLocal.
/// </summary>
public string? Alias { get; set; }

/// <summary>
/// Gets or sets the Endpoint of FoundryLocal.
/// </summary>
public string? Endpoint { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다른 모델들을 보면 Endpoint/BaseUrl 이 Alias/Model 보다 먼저 나옵니다. 여기도 일관성을 맞춰야 하지 않을까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

반영하겠습니다!


/// <summary>
/// Gets or sets the model ID of FoundryLocal.
/// </summary>
public string? ModelId { get; set; }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AliasModelId 의 개념이 조금 달라서,
ModelId를 추가 했습니다.

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alias를 씁니다. 이건 이미 한참전부터 논의하고 결정한 거예요. 굳이 ModelId를 쓸 이유가 없습니다.


/// <summary>
/// Gets or sets a value indicating whether to disable the automatic FoundryLocal manager and use a manually configured endpoint.
/// </summary>
public bool DisableFoundryLocalManager { get; set; }

}
54 changes: 45 additions & 9 deletions src/OpenChat.PlaygroundApp/Connectors/FoundryLocalConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class FoundryLocalConnector(AppSettings settings) : LanguageModelConnecto
{
private readonly AppSettings _appSettings = settings ?? throw new ArgumentNullException(nameof(settings));

private const string ApiKey = "OPENAI_API_KEY";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FoundryLocalManager에 있는 기본 값을 가져왔습니다.

public string ApiKey { get; internal set; } = "OPENAI_API_KEY";


/// <inheritdoc/>
public override bool EnsureLanguageModelSettingsValid()
{
Expand All @@ -26,9 +28,24 @@ public override bool EnsureLanguageModelSettingsValid()
throw new InvalidOperationException("Missing configuration: FoundryLocal.");
}

if (string.IsNullOrWhiteSpace(settings.Alias!.Trim()))
if (settings.DisableFoundryLocalManager == true)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DisableFoundryLocalManager flag에 따라
분기를 가지도록 구조를 잡았습니다.

DisableFoundryLocalManager == true
=> Endpoint, ModelId 만 검증

DisableFoundryLocalManager == false
=> Alias 만 검증

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ModelId 쓰지 않습니다.

{
throw new InvalidOperationException("Missing configuration: FoundryLocal:Alias.");
if (string.IsNullOrWhiteSpace(settings.Endpoint!.Trim()) == true)
{
throw new InvalidOperationException("Missing configuration: FoundryLocal:Endpoint is required when DisableFoundryLocalManager is enabled.");
}

if (string.IsNullOrWhiteSpace(settings.ModelId!.Trim()) == true)
{
throw new InvalidOperationException("Missing configuration: FoundryLocal:ModelId is required when DisableFoundryLocalManager is enabled.");
}
}
else
{
if (string.IsNullOrWhiteSpace(settings.Alias!.Trim()))
{
throw new InvalidOperationException("Missing configuration: FoundryLocal:Alias is required when DisableFoundryLocalManager is disabled.");
}
}

return true;
Expand All @@ -38,22 +55,41 @@ public override bool EnsureLanguageModelSettingsValid()
public override async Task<IChatClient> GetChatClientAsync()
{
var settings = this.Settings as FoundryLocalSettings;
var alias = settings!.Alias!.Trim() ?? throw new InvalidOperationException("Missing configuration: FoundryLocal:Alias.");

var manager = await FoundryLocalManager.StartModelAsync(aliasOrModelId: alias).ConfigureAwait(false);
var model = await manager.GetModelInfoAsync(aliasOrModelId: alias).ConfigureAwait(false);
Uri endpoint;
string modelId;

if (settings!.DisableFoundryLocalManager == true)
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DisableFoundryLocalManager flag에 따라
분기를 가지도록 구조를 잡았습니다.

DisableFoundryLocalManager == true
=> Endpoint, ModelId 만 사용

DisableFoundryLocalManager == false
=> Alias 만 사용

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ModelId 쓰지 않습니다

var settingsEndpoint = settings.Endpoint!.Trim() ?? throw new InvalidOperationException("Missing configuration: FoundryLocal:Endpoint.");
if (Uri.IsWellFormedUriString(settingsEndpoint, UriKind.Absolute) == false)
{
throw new UriFormatException($"Invalid URI: The Foundry Local endpoint '{settingsEndpoint}' is not a valid URI.");
}
endpoint = new Uri(settingsEndpoint);
modelId = settings.ModelId!.Trim() ?? throw new InvalidOperationException("Missing configuration: FoundryLocal:ModelId.");
}
else
{
var alias = settings!.Alias!.Trim() ?? throw new InvalidOperationException("Missing configuration: FoundryLocal:Alias.");
var manager = await FoundryLocalManager.StartModelAsync(aliasOrModelId: alias).ConfigureAwait(false);
var model = await manager.GetModelInfoAsync(aliasOrModelId: alias).ConfigureAwait(false);

endpoint = manager.Endpoint;
modelId = model?.ModelId ?? alias;
}

var credential = new ApiKeyCredential(manager.ApiKey);
var credential = new ApiKeyCredential(ApiKey);
var options = new OpenAIClientOptions()
{
Endpoint = manager.Endpoint,
Endpoint = endpoint,
};

var client = new OpenAIClient(credential, options);
var chatClient = client.GetChatClient(model?.ModelId)
var chatClient = client.GetChatClient(modelId)
.AsIChatClient();

Console.WriteLine($"The {this._appSettings.ConnectorType} connector created with model: {alias}");
Console.WriteLine($"The {this._appSettings.ConnectorType} connector created with model: {modelId}");
Comment on lines +70 to +73
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modelId 쓰지 않습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client.GetChatClient 에서 alias 값을 그대로 사용하면, 에러가 발생합니다.

System.ClientModel.ClientResultException: Service request failed.
Status: 400 (Bad Request)

   at OpenAI.ClientPipelineExtensions.ProcessMessageAsync(ClientPipeline pipeline, PipelineMessage message, RequestOptions options)
   at OpenAI.Chat.ChatClient.CompleteChatAsync(BinaryContent content, RequestOptions options)
   at OpenAI.Chat.ChatClient.<>c__DisplayClass19_0.<<CompleteChatStreamingAsync>b__0>d.MoveNext()


return chatClient;
}
Expand Down
15 changes: 15 additions & 0 deletions src/OpenChat.PlaygroundApp/Constants/ArgumentOptionConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ public static class FoundryLocal
/// Defines the constant for '--alias'.
/// </summary>
public const string Alias = "--alias";

/// <summary>
/// Defines the constant for '--endpoint'.
/// </summary>
public const string Endpoint = "--endpoint";

/// <summary>
/// Defines the constant for '--model-id'.
/// </summary>
public const string ModelId = "--model-id";

/// <summary>
/// Defines the constant for '--disable-foundrylocal-manager'.
/// </summary>
public const string DisableFoundryLocalManager = "--disable-foundrylocal-manager";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 값을 --disable-foundrylocal-manager로 할 것인지 --disable-foundry-local-manager로 할 것인지 --disable-flm`으로 할 것인지, 아니면 다 받아줄 것인지 등등에 대해 우리는 논의를 한 적이 한 번도 없습니다. 어떤 것이 가장 좋은 방법 같은가요?

Copy link
Contributor Author

@name-of-okja name-of-okja Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이러한 접근법으로 생각해도 되는지는 모르겠습니다만..

널널하게 여러 조건을 받아줄 경우에
만약 --disable-foundrylocal-manager, --disable-foundry-local-manager 이 두 개를 허용하면,
상수명을 생각하기 어려워서,

  1. --disable-foundrylocal-manager or --disable-foundry-local-manager
  2. --disable-flm

이렇게 두 개만 받아주는 게 좋지 않을까 생각합니다.

허나 개인적으로는
--disable-flm flm을 보고 Foundry Local Manger를 추론하기도 어색하고, 추후에 Fast LLM Manager 같은 게 생긴다면, 오해의 소지도 있을 것 같습니다.
그리고

--disable-foundrylocal-manager, --disable-foundry-local-manager 이 두 개를 허용하면,
상수명을 생각하기 어려워서,

그래서 개인적으로는 --disable-foundrylocal-manager, --disable-foundry-local-manager 둘 중 하나만 허용하는 게 좋을 것 같다고 생각합니다.

멘토님들의 의견도 궁금합니다!
@tae0y @sikutisa

}

/// <summary>
Expand Down
36 changes: 36 additions & 0 deletions src/OpenChat.PlaygroundApp/Options/FoundryLocalArgumentOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ public class FoundryLocalArgumentOptions : ArgumentOptions
/// </summary>
public string? Alias { get; set; }

/// <summary>
/// Gets or sets the Endpoint of FoundryLocal.
/// </summary>
public string? Endpoint { get; set; }

/// <summary>
/// Gets or sets the model ID of FoundryLocal.
/// </summary>
public string? ModelId { get; set; }

/// <summary>
/// Gets or sets a value indicating whether to disable the automatic FoundryLocal manager and use a manually configured endpoint.
/// </summary>
public bool DisableFoundryLocalManager { get; set; }

/// <inheritdoc/>
protected override void ParseOptions(IConfiguration config, string[] args)
{
Expand All @@ -23,6 +38,9 @@ protected override void ParseOptions(IConfiguration config, string[] args)
var foundryLocal = settings.FoundryLocal;

this.Alias ??= foundryLocal?.Alias;
this.Endpoint ??= foundryLocal?.Endpoint;
this.ModelId ??= foundryLocal?.ModelId;
this.DisableFoundryLocalManager = foundryLocal?.DisableFoundryLocalManager ?? false;

for (var i = 0; i < args.Length; i++)
{
Expand All @@ -35,6 +53,24 @@ protected override void ParseOptions(IConfiguration config, string[] args)
}
break;

case ArgumentOptionConstants.FoundryLocal.Endpoint:
if (i + 1 < args.Length)
{
this.Endpoint = args[++i];
}
break;

case ArgumentOptionConstants.FoundryLocal.ModelId:
if (i + 1 < args.Length)
{
this.ModelId = args[++i];
}
break;

case ArgumentOptionConstants.FoundryLocal.DisableFoundryLocalManager:
this.DisableFoundryLocalManager = true;
Comment on lines 58 to 60
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기선 스위치로 처리했네요?

break;

default:
break;
}
Expand Down
4 changes: 3 additions & 1 deletion src/OpenChat.PlaygroundApp/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
},

"FoundryLocal": {
"Alias": "phi-4-mini"
"Alias": "phi-4-mini",
"Endpoint": "http://127.0.0.1:55438/v1",
"ModelId": "Phi-4-mini-instruct-generic-cpu:4"
},

"HuggingFace": {
Expand Down
Loading