@dataclouder/ngx-agent-cards 0.0.90 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/dataclouder-ngx-agent-cards.mjs +180 -67
- package/fesm2022/dataclouder-ngx-agent-cards.mjs.map +1 -1
- package/lib/components/chat-container/chat-container.component.d.ts +5 -3
- package/lib/components/chat-container/chat-footer/chat-footer.component.d.ts +16 -2
- package/lib/components/chat-container/chat-messages-list/chat-messages-list.component.d.ts +3 -3
- package/lib/components/chat-container/chat-messages-list/message-orchestrator/message-orchestrator.component.d.ts +1 -1
- package/lib/components/{chat-settings → chat-container/chat-settings}/dc-conversation-userchat-settings.component.d.ts +1 -1
- package/lib/models/agent.models.d.ts +17 -9
- package/lib/models/user-data-exchange.d.ts +8 -1
- package/lib/services/conversation.service.d.ts +15 -4
- package/lib/services/evaluation.service.d.ts +2 -3
- package/lib/services/message-processing.service.d.ts +6 -2
- package/package.json +1 -1
- package/public-api.d.ts +1 -1
- package/README.md +0 -324
- /package/lib/{components → utils/icons}/extraction.regex.d.ts +0 -0
- /package/lib/{components → utils}/icons/icon-map.d.ts +0 -0
- /package/lib/{components → utils}/icons/icons.component.d.ts +0 -0
|
@@ -3,9 +3,9 @@ import { MicSettings } from '@dataclouder/ngx-mic';
|
|
|
3
3
|
import { ChatMessage, ChatUserSettings, IAgentCard, IConversationSettings, IMiniAgentCard } from '../../models/agent.models';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export declare class DCChatComponent implements OnInit, OnDestroy {
|
|
6
|
-
private conversationBuilder;
|
|
7
6
|
private dialogService;
|
|
8
7
|
private conversationService;
|
|
8
|
+
private evaluationService;
|
|
9
9
|
private userDataExchange;
|
|
10
10
|
chatUserSettings: ChatUserSettings;
|
|
11
11
|
conversationSettings: IConversationSettings;
|
|
@@ -15,10 +15,12 @@ export declare class DCChatComponent implements OnInit, OnDestroy {
|
|
|
15
15
|
[key: string]: string;
|
|
16
16
|
}>;
|
|
17
17
|
readonly sendMessage: import("@angular/core").OutputEmitterRef<string>;
|
|
18
|
+
readonly goalCompleted: import("@angular/core").OutputEmitterRef<void>;
|
|
19
|
+
messages: import("@angular/core").WritableSignal<ChatMessage[]>;
|
|
18
20
|
micSettings: MicSettings;
|
|
19
21
|
isInfoVisible: boolean;
|
|
20
22
|
isAdmin: boolean;
|
|
21
|
-
|
|
23
|
+
constructor();
|
|
22
24
|
ngOnInit(): Promise<void>;
|
|
23
25
|
ngOnDestroy(): void;
|
|
24
26
|
/**
|
|
@@ -34,5 +36,5 @@ export declare class DCChatComponent implements OnInit, OnDestroy {
|
|
|
34
36
|
*/
|
|
35
37
|
restartConversation(conversation?: IAgentCard | null): Promise<void>;
|
|
36
38
|
static ɵfac: i0.ɵɵFactoryDeclaration<DCChatComponent, never>;
|
|
37
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DCChatComponent, "dc-chat", never, { "chatUserSettings": { "alias": "chatUserSettings"; "required": false; }; "conversationSettings": { "alias": "conversationSettings"; "required": false; }; "agentCard": { "alias": "agentCard"; "required": false; }; "evaluatorAgentCard": { "alias": "evaluatorAgentCard"; "required": false; "isSignal": true; }; "parseDict": { "alias": "parseDict"; "required": false; "isSignal": true; }; }, { "sendMessage": "sendMessage"; }, never, never, true, never>;
|
|
39
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DCChatComponent, "dc-chat", never, { "chatUserSettings": { "alias": "chatUserSettings"; "required": false; }; "conversationSettings": { "alias": "conversationSettings"; "required": false; }; "agentCard": { "alias": "agentCard"; "required": false; }; "evaluatorAgentCard": { "alias": "evaluatorAgentCard"; "required": false; "isSignal": true; }; "parseDict": { "alias": "parseDict"; "required": false; "isSignal": true; }; }, { "sendMessage": "sendMessage"; "goalCompleted": "goalCompleted"; }, never, never, true, never>;
|
|
38
40
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FormControl } from '@angular/forms';
|
|
2
|
-
import { MicSettings } from '@dataclouder/ngx-mic';
|
|
2
|
+
import { MicSettings, AudioRecording } from '@dataclouder/ngx-mic';
|
|
3
3
|
import { ChatMessage, IMiniAgentCard } from '../../../models/agent.models';
|
|
4
|
-
import { AudioRecording } from '@dataclouder/ngx-core';
|
|
5
4
|
import * as i0 from "@angular/core";
|
|
6
5
|
export declare class ChatFooterComponent {
|
|
7
6
|
private conversationService;
|
|
@@ -14,7 +13,14 @@ export declare class ChatFooterComponent {
|
|
|
14
13
|
readonly textInputChanged: import("@angular/core").OutputEmitterRef<string>;
|
|
15
14
|
isGettingTranscription: boolean;
|
|
16
15
|
isUserTalking: boolean;
|
|
16
|
+
micStatus: string;
|
|
17
|
+
private shouldResumeMic;
|
|
17
18
|
chatInputControl: FormControl;
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Method used by the template to determine if the mic should continue listening
|
|
22
|
+
*/
|
|
23
|
+
shouldContinueListening(): boolean;
|
|
18
24
|
score: import("@angular/core").Signal<number>;
|
|
19
25
|
/**
|
|
20
26
|
* Sets the input text in the textarea
|
|
@@ -35,6 +41,14 @@ export declare class ChatFooterComponent {
|
|
|
35
41
|
*/
|
|
36
42
|
private evaluateConversation;
|
|
37
43
|
handleAudioRecorded(event: AudioRecording): void;
|
|
44
|
+
/**
|
|
45
|
+
* Handles the mic status changed event
|
|
46
|
+
* @param event The status event from the mic component
|
|
47
|
+
*/
|
|
48
|
+
handleMicStatusChanged(event: {
|
|
49
|
+
status: string;
|
|
50
|
+
description: string;
|
|
51
|
+
}): void;
|
|
38
52
|
onMicFinished(eventBlob: Blob | any): Promise<void>;
|
|
39
53
|
static ɵfac: i0.ɵɵFactoryDeclaration<ChatFooterComponent, never>;
|
|
40
54
|
static ɵcmp: i0.ɵɵComponentDeclaration<ChatFooterComponent, "dc-chat-footer", never, { "isAIThinking": { "alias": "isAIThinking"; "required": false; "isSignal": true; }; "evaluatorAgentCard": { "alias": "evaluatorAgentCard"; "required": false; "isSignal": true; }; "micSettings": { "alias": "micSettings"; "required": false; "isSignal": true; }; }, { "sendMessage": "sendMessage"; "textInputChanged": "textInputChanged"; }, never, never, true, never>;
|
|
@@ -3,12 +3,12 @@ import { ChatMessage, ChatUserSettings } from '../../../models/agent.models';
|
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class ChatMessagesListComponent implements AfterViewInit {
|
|
5
5
|
readonly chatUserSettings: import("@angular/core").InputSignal<ChatUserSettings>;
|
|
6
|
-
aiIcon: string;
|
|
7
|
-
private conversationService;
|
|
8
6
|
inputMessages: import("@angular/core").InputSignal<ChatMessage[]>;
|
|
7
|
+
private conversationService;
|
|
9
8
|
private elementRef;
|
|
10
|
-
|
|
9
|
+
aiIcon: string;
|
|
11
10
|
isThinking: import("@angular/core").Signal<boolean>;
|
|
11
|
+
messages: import("@angular/core").Signal<ChatMessage[]>;
|
|
12
12
|
constructor();
|
|
13
13
|
ngAfterViewInit(): void;
|
|
14
14
|
scrollToBottom(): void;
|
|
@@ -2,11 +2,11 @@ import { OnInit } from '@angular/core';
|
|
|
2
2
|
import { ChatRole, MessageAudio } from '../../../../models/agent.models';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class MessageOrchestratorComponent implements OnInit {
|
|
5
|
-
private agentCardService;
|
|
6
5
|
private conversationService;
|
|
7
6
|
messages: import("@angular/core").InputSignal<MessageAudio[]>;
|
|
8
7
|
messageRole: import("@angular/core").InputSignal<ChatRole>;
|
|
9
8
|
messagesSignal: import("@angular/core").WritableSignal<MessageAudio[]>;
|
|
9
|
+
private messagesEffect;
|
|
10
10
|
readonly playAudio: import("@angular/core").OutputEmitterRef<MessageAudio>;
|
|
11
11
|
readonly audioCompleted: import("@angular/core").OutputEmitterRef<MessageAudio>;
|
|
12
12
|
private audioQueue;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OnInit, TemplateRef } from '@angular/core';
|
|
2
|
-
import { TextEngines } from '
|
|
2
|
+
import { TextEngines } from '../../../models/conversation-enums';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class DCConversationUserChatSettingsComponent implements OnInit {
|
|
5
5
|
private dialogRef;
|
|
@@ -29,7 +29,7 @@ export interface IAIModel {
|
|
|
29
29
|
export interface ITTS {
|
|
30
30
|
voice: string;
|
|
31
31
|
secondaryVoice: string;
|
|
32
|
-
speed:
|
|
32
|
+
speed: AudioSpeed;
|
|
33
33
|
speedRate: number;
|
|
34
34
|
}
|
|
35
35
|
export interface IAgentMetadata {
|
|
@@ -79,6 +79,20 @@ export interface IAgentCard {
|
|
|
79
79
|
metaApp?: IAgentMetadata;
|
|
80
80
|
accounts?: Array<IAccounts>;
|
|
81
81
|
}
|
|
82
|
+
export interface ISimpleAgent {
|
|
83
|
+
systemPrompt: string;
|
|
84
|
+
model: IAIModel;
|
|
85
|
+
}
|
|
86
|
+
export interface ISimpleTask {
|
|
87
|
+
task: string;
|
|
88
|
+
}
|
|
89
|
+
export interface IMiniAgentCard {
|
|
90
|
+
task: string;
|
|
91
|
+
messages: ChatMessage[];
|
|
92
|
+
expectedResponseType: string;
|
|
93
|
+
model: IAIModel;
|
|
94
|
+
sources: string[];
|
|
95
|
+
}
|
|
82
96
|
export declare enum EAccountsPlatform {
|
|
83
97
|
Tiktok = "tiktok",
|
|
84
98
|
Instagram = "instagram",
|
|
@@ -91,13 +105,6 @@ export interface IAccounts {
|
|
|
91
105
|
authMethod: string;
|
|
92
106
|
pass: string;
|
|
93
107
|
}
|
|
94
|
-
export interface IMiniAgentCard {
|
|
95
|
-
task: string;
|
|
96
|
-
messages: ChatMessage[];
|
|
97
|
-
expectedResponseType: string;
|
|
98
|
-
model: IAIModel;
|
|
99
|
-
sources: string[];
|
|
100
|
-
}
|
|
101
108
|
export type TranscriptionsWhisper = {
|
|
102
109
|
text: string;
|
|
103
110
|
task: string;
|
|
@@ -121,8 +128,9 @@ export declare class MessageAudio {
|
|
|
121
128
|
content?: string;
|
|
122
129
|
voice?: string;
|
|
123
130
|
shouldPlayAudio?: boolean;
|
|
124
|
-
messageId?: string
|
|
131
|
+
messageId?: string;
|
|
125
132
|
tag?: string;
|
|
133
|
+
imgUrl?: string;
|
|
126
134
|
}
|
|
127
135
|
export declare enum ChatRole {
|
|
128
136
|
System = "system",
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import { InjectionToken, Provider, Type } from '@angular/core';
|
|
2
2
|
import { ChatUserSettings } from './agent.models';
|
|
3
3
|
export interface UserDataExchange {
|
|
4
|
+
imgUrl: string;
|
|
4
5
|
name: string;
|
|
5
6
|
gender: string;
|
|
6
7
|
age: number;
|
|
7
8
|
baseLang?: string;
|
|
8
9
|
targetLang?: string;
|
|
9
10
|
}
|
|
10
|
-
export declare const USER_DATA_EXCHANGE: InjectionToken<
|
|
11
|
+
export declare const USER_DATA_EXCHANGE: InjectionToken<UserDataExchangeAbstractService>;
|
|
11
12
|
export declare function provideUserDataExchange(serviceImplementation: Type<UserDataExchangeAbstractService>): Provider[];
|
|
12
13
|
export declare abstract class UserDataExchangeAbstractService {
|
|
13
14
|
abstract getUserDataExchange(): UserDataExchange;
|
|
15
|
+
abstract getUserDataDescriptions(): {
|
|
16
|
+
key: string;
|
|
17
|
+
value: any;
|
|
18
|
+
description: string;
|
|
19
|
+
}[];
|
|
14
20
|
abstract getParseDict(): {
|
|
15
21
|
[key: string]: string;
|
|
16
22
|
};
|
|
17
23
|
abstract getUserChatSettings(): ChatUserSettings;
|
|
24
|
+
abstract getUserDataInformation(): string;
|
|
18
25
|
}
|
|
@@ -10,15 +10,26 @@ export declare class ConversationService {
|
|
|
10
10
|
private isThinkingSignal;
|
|
11
11
|
private conversationSettingsSignal;
|
|
12
12
|
private isDestroyedSignal;
|
|
13
|
+
micStatusSignal: import("@angular/core").WritableSignal<"error" | "ready" | "recording" | "listening" | "initializing" | "inactive" | "paused">;
|
|
14
|
+
currentAudioStatus: import("@angular/core").WritableSignal<{
|
|
15
|
+
message: MessageAudio;
|
|
16
|
+
completed: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
private avatarImages;
|
|
13
19
|
getMessagesSignal(): Signal<ChatMessage[]>;
|
|
14
|
-
addMessage(message: ChatMessage):
|
|
20
|
+
addMessage(message: ChatMessage): string;
|
|
21
|
+
updateMessage(messageId: string, updatedMessage: Partial<ChatMessage>): boolean;
|
|
15
22
|
isThinking(): Signal<boolean>;
|
|
16
23
|
setDestroyed(value: boolean): void;
|
|
17
|
-
setupConversationWithAgentCard(agentCard: IAgentCard
|
|
24
|
+
setupConversationWithAgentCard(agentCard: IAgentCard, parseDict?: {
|
|
25
|
+
[key: string]: string;
|
|
26
|
+
}): void;
|
|
18
27
|
initConversationWithSettings(conversationSettings: IConversationSettings): Promise<void>;
|
|
19
28
|
private initConversation;
|
|
20
|
-
initConversationWithAgentCard(agentCard: IAgentCard
|
|
21
|
-
|
|
29
|
+
initConversationWithAgentCard(agentCard: IAgentCard, parseDict?: {
|
|
30
|
+
[key: string]: string;
|
|
31
|
+
}): Promise<void>;
|
|
32
|
+
sendUserMessage(message: ChatMessage, updateId?: string): Promise<void>;
|
|
22
33
|
sendCurrentConversation(): Promise<void>;
|
|
23
34
|
resetConversation(agentCard?: IAgentCard): Promise<void>;
|
|
24
35
|
getTTSFile(message: MessageAudio): Promise<AudioGenerated>;
|
|
@@ -3,13 +3,12 @@ import { ChatMessage, IMiniAgentCard } from '../models/agent.models';
|
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class EvaluationService {
|
|
5
5
|
private agentCardService;
|
|
6
|
+
private toastService;
|
|
6
7
|
private scoreSignal;
|
|
7
8
|
private evaluationResultSignal;
|
|
8
|
-
/** Inserted by Angular inject() migration for backwards compatibility */
|
|
9
|
-
constructor(...args: unknown[]);
|
|
10
9
|
getScore(): Signal<number>;
|
|
11
10
|
getEvaluationResult(): Signal<any>;
|
|
12
|
-
evaluateConversation(messages: ChatMessage[], evaluator: IMiniAgentCard): Promise<
|
|
11
|
+
evaluateConversation(messages: ChatMessage[], evaluator: IMiniAgentCard): Promise<any>;
|
|
13
12
|
private updateScore;
|
|
14
13
|
resetScore(): void;
|
|
15
14
|
static ɵfac: i0.ɵɵFactoryDeclaration<EvaluationService, never>;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { ChatMessage, IConversationSettings } from '../models/agent.models';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
+
interface ExtraData {
|
|
4
|
+
userImg: string;
|
|
5
|
+
assistantImg: string;
|
|
6
|
+
}
|
|
3
7
|
export declare class MessageProcessingService {
|
|
4
|
-
|
|
5
|
-
processMessage(message: ChatMessage, conversationSettings: IConversationSettings): ChatMessage;
|
|
8
|
+
processMessage(message: ChatMessage, conversationSettings: IConversationSettings, extraData?: ExtraData): ChatMessage;
|
|
6
9
|
private processMultiMessages;
|
|
7
10
|
subsItalicsByTag(text: string, voiceId?: string, tagName?: string): string;
|
|
8
11
|
getVoice(voice_value: string, targetLang?: string): string;
|
|
9
12
|
static ɵfac: i0.ɵɵFactoryDeclaration<MessageProcessingService, never>;
|
|
10
13
|
static ɵprov: i0.ɵɵInjectableDeclaration<MessageProcessingService>;
|
|
11
14
|
}
|
|
15
|
+
export {};
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -17,4 +17,4 @@ export * from './lib/components/chat-container/chat.models';
|
|
|
17
17
|
export * from './lib/components/text-highlighter/text-highlighter';
|
|
18
18
|
export * from './lib/components/chat-container/chat-messages-list/chat-message/chat-message.utils';
|
|
19
19
|
export * from './lib/components/chat-container/chat-messages-list/message-orchestrator/message-orchestrator.component';
|
|
20
|
-
export * from './lib/
|
|
20
|
+
export * from './lib/utils/icons/extraction.regex';
|
package/README.md
DELETED
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
# Description
|
|
2
|
-
|
|
3
|
-
This is library for Chatting with AI Agents.
|
|
4
|
-
|
|
5
|
-
The library introduces a new concept: Agent Card.
|
|
6
|
-
|
|
7
|
-
This is general structure that Can handle all kind of conversation: character cards, situations, scenarios, and more.
|
|
8
|
-
|
|
9
|
-
Uses the concept of Character Specifications V2, since is the most popular so far.
|
|
10
|
-
https://github.com/malfoyslastname/character-card-spec-v2
|
|
11
|
-
|
|
12
|
-
but improves with this new concept called of Agent cards Conversations.
|
|
13
|
-
|
|
14
|
-
## Settings
|
|
15
|
-
|
|
16
|
-
The library depends on your own connections with LLMs, so you need to provide a service that implements the specifications.
|
|
17
|
-
|
|
18
|
-
Any model works well.
|
|
19
|
-
|
|
20
|
-
Provide this service in your `main.ts` using the function `provideChatAIService`:
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
import { provideChatAIService } from '@dataclouder/ngx-agent-cards';
|
|
24
|
-
|
|
25
|
-
provideChatAIService(AgentCardsService);
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Create your own service implementing the interface:
|
|
29
|
-
|
|
30
|
-
```typescript
|
|
31
|
-
import { AgentCardsAbstractService } from '@dataclouder/ngx-agent-cards';
|
|
32
|
-
|
|
33
|
-
export class AgentCardsService implements AgentCardsAbstractService {
|
|
34
|
-
constructor(private httpService: HttpService, private userService: UserService) {}
|
|
35
|
-
|
|
36
|
-
public async callChatCompletion(conversation: ConversationPromptSettings): Promise<any> {
|
|
37
|
-
// Implementation here
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Dependencies
|
|
43
|
-
|
|
44
|
-
1. Angular Core
|
|
45
|
-
|
|
46
|
-
2. Angular cdk only for internal dialog, dont forget to include css
|
|
47
|
-
@import '@angular/cdk/overlay-prebuilt.css';
|
|
48
|
-
|
|
49
|
-
3. @dataclouder/storage-uploader to upload to GCP
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
"@angular/common": ">=18.0.0",
|
|
53
|
-
"@angular/core": ">=18.0.0",
|
|
54
|
-
"@angular/cdk": ">=18.0.0",
|
|
55
|
-
"@dataclouder/storage-uploader": ">=0.0.4"
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Implementing Abstract Service
|
|
59
|
-
|
|
60
|
-
in order to make this library compatible with your own logic you have provide a service implemeting AgentCardsAbstractService.
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
export abstract class AgentCardsAbstractService {
|
|
65
|
-
// call the llm to implement the completion
|
|
66
|
-
abstract callChatCompletion(conversation: ConversationDTO): Promise<any>;
|
|
67
|
-
// get the id of your card
|
|
68
|
-
abstract findConversationCard(id: string): Promise<IAgentCard>;
|
|
69
|
-
// get all conversation cards
|
|
70
|
-
abstract getAllConversationCards(): Promise<IAgentCard[]>;
|
|
71
|
-
|
|
72
|
-
abstract saveConversationCard(conversation: IAgentCard): Promise<IAgentCard>;
|
|
73
|
-
|
|
74
|
-
abstract deleteConversationCard(id: string): Promise<IAgentCard>;
|
|
75
|
-
|
|
76
|
-
abstract getTextAudioFile(tts: any): Promise<any>;
|
|
77
|
-
|
|
78
|
-
abstract getConversationUserSettings(): Promise<ChatUserSettings>;
|
|
79
|
-
|
|
80
|
-
abstract getConversationChatSettings(): Promise<ConversationPromptSettings>;
|
|
81
|
-
|
|
82
|
-
// strategy to save converstionUserSettings.
|
|
83
|
-
abstract saveConversationUserChatSettings(conversation: ChatUserSettings): Promise<ChatUserSettings>;
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Components
|
|
88
|
-
|
|
89
|
-

|
|
90
|
-
|
|
91
|
-
- **AgentCardListComponent**: Connects with backends shows availible conversations.
|
|
92
|
-
|
|
93
|
-
- **DcAgentCardDetailsComponent**: Visualize Conversation Card details and start a conversation.
|
|
94
|
-
|
|
95
|
-
- **DCChatComponent**: Start a conversation:
|
|
96
|
-
|
|
97
|
-
<div style="display: flex; align-items: flex-start; gap: 20px;">
|
|
98
|
-
<div style="flex: 1">
|
|
99
|
-
<strong> *DCAgentCardFormComponent</strong>: This component is used to manage the conversation card data.
|
|
100
|
-
</div>
|
|
101
|
-
<div style="flex: 1">
|
|
102
|
-
<img src="./docs/conversation-form.png" alt="Component Diagram">
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
<div style="display: flex; align-items: flex-start; gap: 20px;">
|
|
107
|
-
<div style="flex: 1">
|
|
108
|
-
<strong> *DCChatSettingsComponent</strong>: this is use to change chat settings
|
|
109
|
-
</div>
|
|
110
|
-
<div style="flex: 1">
|
|
111
|
-
<img src="./docs/chat-settings.png" alt="Component Diagram">
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
- **ChatMessageComponent**
|
|
115
|
-
|
|
116
|
-
## Changing CSS components.
|
|
117
|
-
|
|
118
|
-
There are 3 options, to custom a DC component.
|
|
119
|
-
|
|
120
|
-
1. HARD: totaly custom: need to know the libraries, import the raw components and rewrite the logic, or copy same logic just change what you need.
|
|
121
|
-
2. Pass the component you want to substitude. WIP
|
|
122
|
-
|
|
123
|
-
3. EASY: Pass the CSS.
|
|
124
|
-
|
|
125
|
-
## About conversations tecnical explanation
|
|
126
|
-
|
|
127
|
-
Character AI is evolving quickly, but there is no clear path on who is leading or proposing new standards.
|
|
128
|
-
|
|
129
|
-
For now, all implementations contain V2 of character AI.
|
|
130
|
-
|
|
131
|
-
This project contains better explanations about a Char.
|
|
132
|
-
|
|
133
|
-
https://github.com/Bronya-Rand/Prom-Spec-V3
|
|
134
|
-
|
|
135
|
-
This project goes beyond that, providing a new abstraction that can contain one or multiple characters and more conditions for the characters' interactions.
|
|
136
|
-
|
|
137
|
-
I call this:
|
|
138
|
-
|
|
139
|
-
Conversation AI V1
|
|
140
|
-
|
|
141
|
-
Here are the specs for V1:
|
|
142
|
-
|
|
143
|
-
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.
|
|
144
|
-
|
|
145
|
-
```typescript
|
|
146
|
-
export interface IAgentCard {
|
|
147
|
-
version: string;
|
|
148
|
-
id: string;
|
|
149
|
-
title: string;
|
|
150
|
-
|
|
151
|
-
characterCard: CharaCard;
|
|
152
|
-
|
|
153
|
-
textEngine: TextEngines;
|
|
154
|
-
conversationType: ScenarioType;
|
|
155
|
-
lang: string;
|
|
156
|
-
|
|
157
|
-
tts: {
|
|
158
|
-
voice: string;
|
|
159
|
-
secondaryVoice: string;
|
|
160
|
-
speed: string;
|
|
161
|
-
speedRate: number;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
metaApp: {
|
|
165
|
-
isPublished: boolean;
|
|
166
|
-
isPublic: any;
|
|
167
|
-
authorId: string;
|
|
168
|
-
authorEmail: string;
|
|
169
|
-
createdAt: Date;
|
|
170
|
-
updatedAt: Date;
|
|
171
|
-
takenCount: number;
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
`characterCard`: The card you want to use to talk.
|
|
177
|
-
|
|
178
|
-
`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.
|
|
179
|
-
|
|
180
|
-
`conversationType`: This can be general purpose just to tag it, or the app can modify the conversation depending on the type.
|
|
181
|
-
|
|
182
|
-
`lang`: The main language where the app is intended to operate.
|
|
183
|
-
|
|
184
|
-
`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.
|
|
185
|
-
|
|
186
|
-
`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.
|
|
187
|
-
|
|
188
|
-
### How works
|
|
189
|
-
|
|
190
|
-
multiple systems need to use chats, and add functionalities for chatting.
|
|
191
|
-
|
|
192
|
-
This functionality is usually the same.
|
|
193
|
-
|
|
194
|
-
Conversation Types
|
|
195
|
-
|
|
196
|
-
- General
|
|
197
|
-
- Reflextion:
|
|
198
|
-
- Role Play
|
|
199
|
-
- Role Play With Narrador
|
|
200
|
-
- Challenge
|
|
201
|
-
|
|
202
|
-
### How User and Chat Settings works.
|
|
203
|
-
|
|
204
|
-
This is one of the biggest problems, app need to handle this an provide a service that is able to retrive this settings.
|
|
205
|
-
|
|
206
|
-
There are multiple ways to use the chat, and there are
|
|
207
|
-
functionalities availible, Users can save this functions and thats why you need the object ChatUserSettings,
|
|
208
|
-
Chat are settings that does not depend on the user but in the application.
|
|
209
|
-
|
|
210
|
-
Check the object.
|
|
211
|
-
|
|
212
|
-
#### ChatUserSettings
|
|
213
|
-
|
|
214
|
-
Conversation Chat User Settings.
|
|
215
|
-
This is an implementation app can handle, it can be locally settings by defult saving on browers or DB.
|
|
216
|
-
basically user have the object ChatUserSettings
|
|
217
|
-
|
|
218
|
-
```typescript
|
|
219
|
-
export class ChatUserSettings {
|
|
220
|
-
realTime: boolean;
|
|
221
|
-
repeatRecording: boolean;
|
|
222
|
-
fixGrammar: boolean;
|
|
223
|
-
superHearing: boolean;
|
|
224
|
-
voice: string;
|
|
225
|
-
autoTranslate: boolean;
|
|
226
|
-
highlightWords: boolean;
|
|
227
|
-
synthVoice: boolean;
|
|
228
|
-
modelName: string;
|
|
229
|
-
provider: string;
|
|
230
|
-
speed: string;
|
|
231
|
-
speedRate: number; // temporal
|
|
232
|
-
}
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
#### ConversationPromptSettings
|
|
236
|
-
|
|
237
|
-
```typescript
|
|
238
|
-
export class ConversationPromptSettings {
|
|
239
|
-
messages?: ChatMessage[];
|
|
240
|
-
last_prompt?: string;
|
|
241
|
-
conversationType?: ConversationType;
|
|
242
|
-
textEngine?: string;
|
|
243
|
-
voice?: string; // first voice
|
|
244
|
-
secondaryVoice?: string; // apply for narrator
|
|
245
|
-
overrideConversationSettings?: Partial<ChatUserSettings>;
|
|
246
|
-
}
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
Those are object to need to think how to store, create and pass to the chat.
|
|
250
|
-
|
|
251
|
-
### How to parse conversation instructions.
|
|
252
|
-
|
|
253
|
-
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.
|
|
254
|
-
|
|
255
|
-
Silly tarvern called this macros.
|
|
256
|
-
https://docs.sillytavern.app/usage/core-concepts/macros/#general-macros
|
|
257
|
-
|
|
258
|
-
wilds, macros, parse dict, will reference to the same.
|
|
259
|
-
|
|
260
|
-
{{user}}:
|
|
261
|
-
{{bot}}:
|
|
262
|
-
|
|
263
|
-
You have to create your custom function when you want to parse,
|
|
264
|
-
|
|
265
|
-
Exmaple: Polilan add more wilds for the same porpuse that helps to add context of learning languages.
|
|
266
|
-
|
|
267
|
-
{{word}}: is the words the user is studing
|
|
268
|
-
{{targe}}: is the language the user wants to learn
|
|
269
|
-
{{base}}: is the user native language
|
|
270
|
-
|
|
271
|
-
##### Build messages to start a conversation
|
|
272
|
-
|
|
273
|
-
- conversation need attached all the data from the character card.
|
|
274
|
-
- this is my format.
|
|
275
|
-
|
|
276
|
-

|
|
277
|
-
|
|
278
|
-
### Componentes in details
|
|
279
|
-
|
|
280
|
-
1. **DCDCAgentCardFormComponent**
|
|
281
|
-
|
|
282
|
-
#### Inputs:
|
|
283
|
-
|
|
284
|
-
**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.
|
|
285
|
-
|
|
286
|
-
**storageSettings**: StorageSettings: you can override the default setting for cropping:
|
|
287
|
-
{ cropImageSettings: { path: '', fileName: '', resizeToWidth: 450 }, ratioType: AspectType.Vertical_9_16, resolutions: [ResolutionType.MediumLarge], };
|
|
288
|
-
|
|
289
|
-
#### Outputs
|
|
290
|
-
|
|
291
|
-
onImageLoaded: when the image is loaded in the storage.
|
|
292
|
-
|
|
293
|
-
onSave: when user click save
|
|
294
|
-
|
|
295
|
-
2. **ChatComponent**
|
|
296
|
-
|
|
297
|
-
### Inputs
|
|
298
|
-
|
|
299
|
-
**chatUserSettings** : if you want to hardcode the settings, otherwise will use the provided AgentCardsAbstractService
|
|
300
|
-
|
|
301
|
-
**conversationCardId**:
|
|
302
|
-
|
|
303
|
-
### Outputs
|
|
304
|
-
|
|
305
|
-
### How to add TTS.
|
|
306
|
-
|
|
307
|
-
There are multiple services that impruve Speaking App Capabilities, i think in future backend will handle all of them and front will only send the settings.
|
|
308
|
-
|
|
309
|
-
For now backend need to implement a service. tts.
|
|
310
|
-
|
|
311
|
-
### How to build and publish new version of this library
|
|
312
|
-
|
|
313
|
-
the component need the cropper as dependency, make sure you already installed or compile that library.
|
|
314
|
-
inside the angular
|
|
315
|
-
is required to build first the dependencies locally
|
|
316
|
-
|
|
317
|
-
npm run build:storage-uploader
|
|
318
|
-
npm run build:core-components
|
|
319
|
-
npm run publish:conversations
|
|
320
|
-
|
|
321
|
-
after that i recommend to remove /dist folder, why ? becouse project path is linked to dist folder first if exits, and the to the source code. so in order to code easier i recommend to remove the dist folder.
|
|
322
|
-
|
|
323
|
-
- npm run build
|
|
324
|
-
- npm run publish
|
|
File without changes
|
|
File without changes
|
|
File without changes
|