Skip to content

This provides a web UI for AI chat playground that is able to connect virtually any LLM from any platform.

License

Notifications You must be signed in to change notification settings

aliencube/open-chat-playground

Repository files navigation

AI Open Chat Playground

This provides a web UI for AI chat playground that is able to connect virtually any LLM from any platform.

Prerequisites

Getting Started

Get the repository ready

  1. Login to GitHub.

    gh auth login
  2. Check login status.

    gh auth status
  3. Fork this repository to your account and clone the forked repository to your local machine.

    gh repo fork aliencube/open-chat-playground --clone --default-branch-only

Run on Local Machine

  1. Get the repository root.

    # bash/zsh
    REPOSITORY_ROOT=$(git rev-parse --show-toplevel)
    # PowerShell
    $REPOSITORY_ROOT = git rev-parse --show-toplevel
  2. Add GitHub Personal Access Token (PAT) for GitHub Models connection. Make sure you should replace {{YOUR_TOKEN}} with your GitHub PAT.

    # bash/zsh
    dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp \
        set GitHubModels:Token "{{YOUR_TOKEN}}"
    # PowerShell
    dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp `
        set GitHubModels:Token "{{YOUR_TOKEN}}"

    For more details about GitHub PAT, refer to the doc, Managing your personal access tokens.

  3. Run the app.

    dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp
  4. Open your web browser and navigate to http://localhost:8080 and enter prompts.

Run Tests

  1. Get the repository root.

    # bash/zsh
    REPOSITORY_ROOT=$(git rev-parse --show-toplevel)
    # PowerShell
    $REPOSITORY_ROOT = git rev-parse --show-toplevel
  2. Restore packages and install playwright.

    cd $REPOSITORY_ROOT && dotnet restore
    pwsh $REPOSITORY_ROOT/test/OpenChat.PlaygroundApp.Tests/bin/Debug/net{YOUR_VERSION}/playwright.ps1 install
  3. Run the app.

    dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp
  4. Run tests.

    # With LLM provider
    cd $REPOSITORY_ROOT && dotnet test
    # Without LLM provider
    cd $REPOSITORY_ROOT && dotnet test --filter "Category!=LLMRequired"

Run on Azure

  1. Get the repository root.

    # bash/zsh
    REPOSITORY_ROOT=$(git rev-parse --show-toplevel)
    # PowerShell
    $REPOSITORY_ROOT = git rev-parse --show-toplevel
  2. Make sure you are at the repository root.

    cd $REPOSITORY_ROOT
  3. Login to Azure.

    # Login to Azure Dev CLI
    azd auth login
    
    # Login to Azure CLI
    az login
  4. Check login status.

    # Azure Dev CLI
    azd auth login --check-status
    
    # Azure CLI
    az account show
  5. Run the following commands in order to provision and deploy the app.

    azd up

    NOTE: You will be asked to provide Azure subscription and location for deployment.

Configure GitHub Actions for CI/CD Pipeline

  1. Make sure you've logged in to Azure.

    azd auth login --check-status
  2. Run pipeline config.

    azd pipeline config
  3. Answer the question below:

    • ? Select how to authenticate the pipeline to Azure 👉 Federated Service Principal (SP + OIDC)
    • ? Would you like to commit and push your local changes to start the configured CI pipeline? 👉 No
  4. Once the configuration is done, push a new commit to GitHub to run the GitHub Actions workflow.

About

This provides a web UI for AI chat playground that is able to connect virtually any LLM from any platform.

Resources

License

Stars

Watchers

Forks

Contributors 16