npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dataclouder/conversation-system

v0.0.21

Published

This is an experimental and unstable Angular library for chatting with AI assistants.

Downloads

1,215

Readme

Description

This is an experimental and unstable Angular library for chatting with AI assistants.

Uses the concept of character Specifications but improves with this new concept called ConversationAI.

Settings

The library depends on your own connections with LLMs, so you need to provide a service that implements the specifications.

Any model works well.

Provide this service in your main.ts using the function provideChatAIService:

import { provideChatAIService } from '@dataclouder/conversation-system';

provideChatAIService(ConversationAIService);

Create your own service implementing the interface:

import { ConversationAIAbstractService } from '@dataclouder/conversation-system';

export class ConversationAIService implements ConversationAIAbstractService {
  constructor(private httpService: HttpService, private userService: UserService) {}

  public async callChatCompletion(conversation: ConversationPromptSettings): Promise<any> {
    // Implementation here
  }
}

Components

Component Diagram

  • ConversationCardListsComponent: Connects with backends shows availible conversations.

  • DcConversationCardDetailsComponent: Visualize Conversation Card details and start a conversation.

  • DCChatComponent: Start a conversation

  • DCDCConversationFormComponent:

  • ChatMessageComponent

Conversation V1

Character AI is evolving quickly, but there is no clear path on who is leading or proposing new standards.

For now, all implementations contain V2 of character AI.

This project contains better explanations about a Char.

https://github.com/Bronya-Rand/Prom-Spec-V3

This project goes beyond that, providing a new abstraction that can contain one or multiple characters and more conditions for the characters' interactions.

I call this:

Conversation AI V1

Here are the specs for V1:

This first version can only have one character. I need to understand a little bit more to create conversations with multiple characters, which I'll include in the second version.

export interface IConversationCard {
  version: string;
  id: string;
  title: string;

  characterCard: CharaCard;

  textEngine: TextEngines;
  conversationType: ScenarioType;
  lang: string;

  tts: {
    voice: string;
    secondaryVoice: string;
    speed: string;
    speedRate: number;
  };

  metaApp: {
    isPublished: boolean;
    isPublic: any;
    authorId: string;
    authorEmail: string;
    createdAt: Date;
    updatedAt: Date;
    takenCount: number;
  };
}

characterCard: The card you want to use to talk.

textEngine: In order to read text, there are multiple formats in markdown. Depending on your format, the engine needs to read and highlight in different ways. Also, the app itself can create its own engine to add more functionalities.

conversationType: This can be general purpose just to tag it, or the app can modify the conversation depending on the type.

lang: The main language where the app is intended to operate.

tts: Extra functionalities to add TTS. I need to think more on this. In the future, voices will probably be free or downloadable. For now, it is only the ID of the voice. There are only two voices in the first approach.

metaApp: Everything your app needs to work. Audit data, how many times your app has been used, if the conversation is a challenge type, you can count how many passed or failed, etc.

How works

multiple systems need to use chats, and add functionalities for chatting.

This functionality is usually the same.

Conversation Types

  • General
  • Reflextion:
  • Role Play
  • Role Play With Narrador
  • Challenge

How User and Chat Settings works.

This is one of the biggest problems, app need to handle this an provide a service that is able to retrive this settings.

There are multiple ways to use the chat, and there are functionalities availible, Users can save this functions and thats why you need the object ConversationUserSettings, Chat are settings that does not depend on the user but in the application.

Check the object.

ConversationUserSettings

export class ConversationUserSettings {
  realTime: boolean;
  repeatRecording: boolean;
  fixGrammar: boolean;
  superHearing: boolean;
  voice: string;
  autoTranslate: boolean;
  highlightWords: boolean;
  synthVoice: boolean;
  modelName: string;
  provider: string;
  speed: string;
  speedRate: number; // temporal
}

ConversationPromptSettings

export class ConversationPromptSettings {
  messages?: ChatMessage[];
  last_prompt?: string;
  conversationType?: ConversationType;
  textEngine?: string;
  voice?: string; // first voice
  secondaryVoice?: string; // apply for narrator
  overrideConversationSettings?: Partial<ConversationUserSettings>;
}

Those are object to need to think how to store, create and pass to the chat.

How to parse conversation instructions.

In order to adapt the conversartion to the current user, Character Cards use some wild words that are parsed before conversation start, so LLM is aware of name age and other data to make a custum conversation.

this Wilds are

{{user}}: {{}}:

Polilan add more wilds for the same porpuse that helps to add context.

{{word}}: is the words the user is studing {{targe}}: is the language the user wants to learn {{base}}: is the user native language

TODO: this same logic can apply for every diferent app, think on how to abstract and create standard for this.

Build messages to start a conversation
  • conversation need attached all the data from the character card.
  • this is my format.

Component Diagram

Componentes in details

  1. DCDCConversationFormComponent

Inputs:

conversationCardId: string; is the id for the conversation to modify will look up for this in api otherwise is empty card. if is not passed will look for the id in the URL.

storageSettings: StorageSettings: you can override the default setting for cropping: { cropImageSettings: { path: '', fileName: '', resizeToWidth: 450 }, ratioType: AspectType.Vertical_9_16, resolutions: [ResolutionType.MediumLarge], };

Outputs

onImageLoaded: when the image is loaded in the storage.

onSave: when user click save

  1. Chat
How to build a publish new version

the component need the cropper as dependency, make sure you already installed or compile that library.

  • npm run build
  • npm run publish