Sitelet https://github.com/micode-ai/ngx-open-web-ui-chat
Skip to content

Latest commit

ย 

History

34 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

OpenWebUI TypeScript Embedded SDK

License

Modern Angular 20 library for embedding OpenWebUI chat in your applications with full conversation history, markdown support, and Angular 2025 architecture.

๐ŸŒ Live Demo

Try the live demo โ†’

Interactive demo showcasing all features:

  • Dynamic configuration
  • Model selection
  • Real-time chat with conversation history
  • Markdown rendering
  • Multi-language support

๐Ÿ“– How to Use the Application

Quick Start Guide

Step 1: Initial Configuration

When you first launch the application, enter your OpenWebUI server details:

Initial Screen

Required:

  1. Host URL - Your OpenWebUI server address (e.g., http://localhost:8080)
  2. API Key - Your API authentication key

Step 2: Load Available Models

Click "Show Models" to fetch the list of AI models from your server:

Models Loaded

Step 3: Select Your Model

Choose an AI model from the dropdown menu:

Model Selected

Step 4: Connect to Chat

Click "Connect Chat" to initialize your chat session:

Chat Connected

Step 5: Start Chatting

Type your message and click "Send" or press Enter:

Typing Message

Features:

  • View all conversations
  • Organize chats into folders
  • Pin important chats
  • Search through history
  • Archive old conversations
  • Export chats (PDF, TXT, JSON)

๐Ÿ“ Notes Management

Create and manage notes with a built-in markdown editor:

Notes Panel

Features:

  • Rich markdown editor
  • Auto-save functionality
  • Search through notes
  • Reference notes in chats
  • Organize with folders

โœจ Features

  • ๐Ÿš€ Angular 2025 Ready - Zoneless, Signals, Modern file structure
  • ๐Ÿ’ฌ Conversation History - AI remembers all previous messages
  • ๐Ÿ“ Markdown Support - Rich text rendering with ngx-markdown
  • โšก Signals & Zoneless - Latest Angular reactive patterns
  • ๐Ÿ“ก Streaming Responses - Real-time chat with typing indicator
  • โน๏ธ Stop Generation - Cancel AI response at any time
  • ๐ŸŽค Voice Input - Record audio messages with automatic transcription
  • ๐ŸŒ Multi-language - 10 languages supported
  • ๐ŸŽจ Customizable - SCSS with modern features
  • ๐Ÿ”ง TypeScript - Full type safety
  • ๐Ÿ“ฑ Responsive - Mobile-friendly design
  • โญ Response Actions - Continue, regenerate, and rate responses
  • ๐Ÿ‘ Rating System - Comprehensive feedback with good/bad ratings
  • ๐Ÿ“ค Chat Export - Download conversations as PDF, TXT, or JSON
  • ๐Ÿ›ก๏ธ Safe Deletion - Prevents accidental deletion of active chats
  • ๐Ÿ’ฌ Ask & Explain - Context menu for selected text with AI explanations
  • ๐Ÿ“‚ Folder Support - Organize chats into folders with drag & drop
  • ๐Ÿ“ Notes Support - Integrated markdown note editor with sidebar
  • ๐Ÿ—ƒ๏ธ Archived Chats - View, search, unarchive, and delete archived conversations
  • ๐Ÿ”Œ Integrations - Toggle Web Search and Code Interpreter capabilities
  • ๐Ÿ› ๏ธ Tools Support - Access and enable server-side tools from Open WebUI API
  • ๐Ÿ’ฌ Reference Chats - Reference previous conversations in new messages
  • ๐Ÿ“ Reference Notes - Reference notes in new messages
  • ๐ŸŒ Web Page Attachment - Process and attach web page content to messages
  • ๐ŸŽ›๏ธ Feature Toggles - Conditional display of advanced features

๐Ÿš€ Quick Start

Installation

npm install ngx-open-web-ui-chat

Setup

1. Configure Bootstrap (main.ts)

import { bootstrapApplication } from '@angular/platform-browser';
import { provideZonelessChangeDetection } from '@angular/core';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { provideMarkdown } from 'ngx-markdown';
import { AppComponent } from './app/app.component';

bootstrapApplication(AppComponent, {
  providers: [
    provideZonelessChangeDetection(),  // Zoneless mode!
    provideHttpClient(withInterceptorsFromDi()),
    provideMarkdown()  // For markdown rendering
  ]
}).catch((err) => console.error(err));

2. Use Component

import { Component } from '@angular/core';
import { OpenwebuiChatComponent } from 'ngx-open-web-ui-chat';

@Component({
  standalone: true,
  imports: [OpenwebuiChatComponent],
  template: `
    <openwebui-chat
      [endpoint]="'https://your-openwebui-instance.com'"
      [modelId]="'llama3'"
      [apiKey]="'sk-your-api-key'">
    </openwebui-chat>
  `
})
export class AppComponent {}

๐Ÿ“– Key Concepts

Conversation History

The component automatically maintains conversation context:

[
  {"role": "user", "content": "Hello"},
  {"role": "assistant", "content": "Hi! How can I help?"},
  {"role": "user", "content": "What did I just say?"},
  {"role": "assistant", "content": "You said 'Hello'"}
]

Features:

  • โœ… Full conversation history sent with each request
  • โœ… AI remembers all previous messages
  • โœ… Context-aware responses

Angular 2025 Architecture

Zoneless Change Detection:

provideZonelessChangeDetection()  // No ZoneJS!

Signals for State:

messages = signal<ChatMessage[]>([]);
isLoading = signal(false);

Modern File Structure:

components/
โ”œโ”€โ”€ openwebui-chat.ts       โ† Logic
โ”œโ”€โ”€ openwebui-chat.html     โ† Template
โ””โ”€โ”€ openwebui-chat.scss     โ† Styles (SCSS!)

๐Ÿ“ Project Structure

openwebui-ts-embedded-sdk/
โ”œโ”€โ”€ projects/
โ”‚   โ””โ”€โ”€ ngx-open-web-ui-chat/    # Library package
โ”‚       โ”œโ”€โ”€ src/lib/
โ”‚       โ”‚   โ”œโ”€โ”€ components/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ openwebui-chat.ts
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ openwebui-chat.html
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ openwebui-chat.scss
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ chat-input/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ chat-message/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ chat-history-sidebar/
โ”‚       โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ sidebar/
โ”‚       โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ list/
โ”‚       โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ item/
โ”‚       โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ header/
โ”‚       โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ context-menu/
โ”‚       โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ folder-list/
โ”‚       โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ folder-item/
โ”‚       โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ folder-context-menu/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ archived-chats-modal/       โ† Archived chats modal
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ attach-webpage-modal/       โ† Web page attachment modal
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ note-editor/                โ† Note editor component
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ notes-sidebar/              โ† Notes sidebar component
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ tools-menu/                 โ† Tools selection submenu
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ chat-search-modal/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ confirm-dialog/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ error-banner/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ export-format-menu/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ message-actions/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ rating-form/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ regenerate-menu/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ text-selection-menu/
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ ask-explain-modal/
โ”‚       โ”‚   โ”œโ”€โ”€ services/
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ openwebui-api.ts
โ”‚       โ”‚   โ”œโ”€โ”€ models/
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ chat.model.ts
โ”‚       โ”‚   โ”œโ”€โ”€ utils/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ audio-recorder.ts
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ date-formatter.ts
โ”‚       โ”‚   โ””โ”€โ”€ i18n/
โ”‚       โ”‚       โ””โ”€โ”€ translations.ts
โ”‚       โ””โ”€โ”€ dist/                 # Built package
โ”œโ”€โ”€ test-app/                     # Test application
โ”‚   โ”œโ”€โ”€ src/app/
โ”‚   โ”‚   โ”œโ”€โ”€ app.component.ts
โ”‚   โ”‚   โ”œโ”€โ”€ app.component.html
โ”‚   โ”‚   โ””โ”€โ”€ app.component.scss
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ docs/                         # Documentation
โ”‚   โ”œโ”€โ”€ API.md
โ”‚   โ”œโ”€โ”€ I18N.md
โ”‚   โ”œโ”€โ”€ MARKDOWN.md
โ”‚   โ””โ”€โ”€ CHANGELOG.md
โ”œโ”€โ”€ README.md                     # This file
โ””โ”€โ”€ package.json

๐ŸŽฏ API Reference

Inputs

Input Type Required Default Description
endpoint string โœ… - OpenWebUI instance URL
modelId string โœ… - AI model identifier
apiKey string โœ… - API key
enableMarkdown boolean โŒ true Enable markdown
debug boolean โŒ false Debug logging
language string โŒ 'en' UI language
history boolean โŒ false Enable chat history sidebar
folders boolean โŒ false Enable folder support
notes boolean โŒ false Enable notes feature
integrations boolean โŒ false Enable integrations support
tools boolean โŒ false Enable tools selection menu
showReferenceChats boolean โŒ false Enable reference chat selection
showReferenceNotes boolean โŒ false Enable reference note selection
showAttachWebPage boolean โŒ false Enable web page attachment feature

Outputs

Output Type Description
chatInitialized EventEmitter<void> Chat session ready
messagesChanged EventEmitter<number> Message count changed

Methods

Method Description
sendMessage(message: string) Send a message programmatically
stopGeneration() Stop current AI response generation
clearChat() Clear all messages
createNewChat() Create new chat session
changeModel(modelId: string) Switch to different model

Full API Documentation โ†’

๐Ÿ› ๏ธ Development

Build Library

cd projects/ngx-open-web-ui-chat
npm run build

Output: projects/ngx-open-web-ui-chat/dist/

Test Application

cd test-app
npm start

Visit: http://localhost:4200

Features:

  • Dynamic host & API key configuration
  • Model selection
  • Progressive connection flow
  • Chat controls (clear, disconnect, language)
  • Beautiful UI with step-by-step guide

๐Ÿ“š Documentation

Document Description
API Reference Complete API documentation
Markdown Guide Markdown features & examples
I18N Guide Multi-language support

๐Ÿ”ง Technology Stack

  • Angular 20.x - Latest framework with signals
  • TypeScript 5.8 - Full type safety
  • ng-packagr - Library packaging
  • ngx-markdown - Markdown rendering
  • RxJS - Only for streaming (Angular 2025 pattern)
  • SCSS - Modern styling with nesting

๐Ÿ—๏ธ Angular 2025 Features

โœ… Zoneless Change Detection - No ZoneJS overhead
โœ… Signals - Reactive state management
โœ… Standalone Components - No NgModules
โœ… Modern File Structure - Separated TS/HTML/SCSS
โœ… inject() DI - Modern dependency injection
โœ… Async/Await - Instead of Observable where appropriate
โœ… Computed Properties - Derived state

๐ŸŽจ Examples

Basic Usage

<openwebui-chat
  [endpoint]="'https://ai.example.com'"
  [modelId]="'llama3'"
  [apiKey]="'sk-abc123'">
</openwebui-chat>

With Controls

import { Component, ViewChild } from '@angular/core';
import { OpenwebuiChatComponent } from 'ngx-open-web-ui-chat';

@Component({
  template: `
    <button (click)="clearChat()">Clear</button>
    <button (click)="sendGreeting()">Say Hi</button>
    
    <openwebui-chat
      #chat
      [endpoint]="endpoint"
      [modelId]="modelId"
      [apiKey]="apiKey"
      (messagesChanged)="onMessageCount($event)">
    </openwebui-chat>
    
    <p>Messages: {{ messageCount }}</p>
  `
})
export class AppComponent {
  @ViewChild('chat') chat?: OpenwebuiChatComponent;
  messageCount = 0;
  
  clearChat() {
    this.chat?.clearChat();
  }
  
  sendGreeting() {
    this.chat?.sendMessage('Hello!');
  }
  
  onMessageCount(count: number) {
    this.messageCount = count;
  }
}

Multi-language

<openwebui-chat
  [endpoint]="endpoint"
  [modelId]="modelId"
  [apiKey]="apiKey"
  [language]="'en'">
</openwebui-chat>

Supported languages: en, zh, hi, es, ar, fr, pt, ru, bn, ja

๐Ÿš€ Publishing

# 1. Build
cd projects/ngx-open-web-ui-chat
npm run build

# 2. Publish
cd dist
npm publish --access public

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make changes
  4. Test thoroughly
  5. Submit pull request

๐Ÿ“ License

MIT License - see LICENSE file for details

๐ŸŽ“ Best Practices Implemented

  • โœ… Angular 2025 Architecture - Zoneless, signals, modern patterns
  • โœ… Separation of Concerns - TS/HTML/SCSS files
  • โœ… Type Safety - Full TypeScript strict mode
  • โœ… SCSS Features - Nesting, variables, modern CSS
  • โœ… Conversation Context - Full history maintained
  • โœ… Event-Driven - Reactive communication
  • โœ… Responsive Design - Mobile-friendly
  • โœ… Clean Code - Following Angular style guide

๐Ÿ”ฎ Roadmap

Completed Features โœ…

  • โœ… Conversation history with full context
  • โœ… Real-time streaming with Socket.IO
  • โœ… File upload support
  • โœ… Voice input with transcription
  • โœ… Response actions (continue, regenerate, rate)
  • โœ… Chat export (PDF, TXT, JSON)
  • โœ… Folder organization with drag & drop
  • โœ… Notes with markdown editor
  • โœ… Archived chats management
  • โœ… Tools integration
  • โœ… Reference chats and notes
  • โœ… Web search & code interpreter
  • โœ… Multi-language support (10 languages)
  • โœ… Web page attachment with content processing
  • โœ… Conditional feature display with toggles

Planned Features ๐Ÿš€

  • Image generation support
  • Voice output (TTS)
  • Custom themes
  • Plugin system
  • Collaborative chats
  • Advanced search filters
  • Chat templates
  • Keyboard shortcuts

Status: Production-ready v1.1.0
Angular Version: 20.x
Node Required: >=20.19.0
TypeScript: ~5.8.0

Made with โค๏ธ using Angular 2025 architecture

About

Angular component library for embedding OpenWebUI chat in applications

Resources

Code of conduct

Contributing

Security policy

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages