@dataclouder/ngx-agent-cards 0.0.75

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.
Files changed (31) hide show
  1. package/README.md +314 -0
  2. package/fesm2022/dataclouder-ngx-agent-cards.mjs +2872 -0
  3. package/fesm2022/dataclouder-ngx-agent-cards.mjs.map +1 -0
  4. package/index.d.ts +5 -0
  5. package/lib/components/chat/dc-chat.component.d.ts +60 -0
  6. package/lib/components/chat-message/chat-message.component.d.ts +28 -0
  7. package/lib/components/chat-settings/dc-conversation-userchat-settings.component.d.ts +46 -0
  8. package/lib/components/dc-agent-card-details/dc-agent-card-details.component.d.ts +18 -0
  9. package/lib/components/dc-agent-card-lists/agent-card-default-ui/agent-card-default-ui.component.d.ts +15 -0
  10. package/lib/components/dc-agent-card-lists/dc-agent-card-lists.component.d.ts +42 -0
  11. package/lib/components/dc-agent-form/dc-agent-card-form.component.d.ts +121 -0
  12. package/lib/components/dc-agent-form/generic-form/generic-form.component.d.ts +23 -0
  13. package/lib/components/extraction.regex.d.ts +7 -0
  14. package/lib/components/icons/icon-map.d.ts +9 -0
  15. package/lib/components/icons/icons.component.d.ts +15 -0
  16. package/lib/components/prompt-preview-dialog/prompt-preview-dialog.component.d.ts +11 -0
  17. package/lib/components/provider-selector/provider-selector.component.d.ts +39 -0
  18. package/lib/components/translate-dialog/translate-dialog.component.d.ts +22 -0
  19. package/lib/models/agent.models.d.ts +192 -0
  20. package/lib/models/agent.utils.d.ts +1 -0
  21. package/lib/models/conversation-ai.class.d.ts +27 -0
  22. package/lib/models/conversation-enums.d.ts +47 -0
  23. package/lib/models/stavernUtils.d.ts +15 -0
  24. package/lib/models/user-data-exchange.d.ts +16 -0
  25. package/lib/pipes/scenario.pipe.d.ts +18 -0
  26. package/lib/pipes/speed.pipe.d.ts +14 -0
  27. package/lib/pipes/truncate.pipe.d.ts +7 -0
  28. package/lib/services/audio.service.d.ts +27 -0
  29. package/lib/services/dc-conversation-builder.service.d.ts +27 -0
  30. package/package.json +45 -0
  31. package/public-api.d.ts +15 -0
@@ -0,0 +1,192 @@
1
+ import { CloudStorageData } from '@dataclouder/ngx-cloud-storage';
2
+ import { AudioSpeed, ConversationType, TextEngines } from './conversation-enums';
3
+ export interface CharacterCardData {
4
+ name: string;
5
+ description: string;
6
+ scenario?: string;
7
+ first_mes?: string;
8
+ creator_notes?: string;
9
+ mes_example?: string;
10
+ alternate_greetings?: string[];
11
+ tags?: string[];
12
+ system_prompt?: string;
13
+ post_history_instructions?: string;
14
+ character_version?: string;
15
+ extensions?: Record<string, any>;
16
+ appearance?: string;
17
+ }
18
+ export declare const characterCardStringDataDefinition = "\ninterface CharacterCardData {\n name: string; // Character's name\n description: string; // General character description\n scenario: string; // The setting or context where the character exists\n first_mes: string; // First message the character will say\n mes_example: string; // Example of character's typical message/dialogue\n alternate_greetings: string[]; // Array of alternative greeting messages\n tags: string[]; // Array of descriptive tags\n appearance: string; // Physical description including height, build, hair color/style, eye color, skin tone, distinctive marks, clothing style, current outfit\n}";
19
+ export interface ICharacterCardDC {
20
+ spec?: 'chara_card_v2';
21
+ spec_version?: '2_v_dc';
22
+ data: CharacterCardData;
23
+ }
24
+ export interface IAIModel {
25
+ id?: string;
26
+ modelName?: string;
27
+ provider?: string;
28
+ }
29
+ export interface ITTS {
30
+ voice: string;
31
+ secondaryVoice: string;
32
+ speed: string;
33
+ speedRate: number;
34
+ }
35
+ export interface IAgentMetadata {
36
+ isPublished: boolean;
37
+ isPublic: any;
38
+ authorId: string;
39
+ authorEmail: string;
40
+ createdAt: Date;
41
+ updatedAt: Date;
42
+ takenCount: number;
43
+ }
44
+ export interface IConversationSettings {
45
+ textEngine?: TextEngines;
46
+ conversationType?: ConversationType;
47
+ tts?: ITTS;
48
+ autoStart?: boolean;
49
+ messages?: ChatMessage[];
50
+ last_prompt?: string;
51
+ voice?: string;
52
+ secondaryVoice?: string;
53
+ }
54
+ export type IConversationSettingsDTO = Pick<IConversationSettings, 'messages' | 'textEngine' | 'conversationType'> & {
55
+ model?: IAIModel;
56
+ };
57
+ export interface IAgentResponseDTO {
58
+ role: ChatRole;
59
+ content: string;
60
+ metadata: any;
61
+ }
62
+ export interface IAgentAssets {
63
+ image?: CloudStorageData;
64
+ bannerImg?: CloudStorageData;
65
+ stickers?: Array<CloudStorageData>;
66
+ }
67
+ export interface IAgentCard {
68
+ version?: string;
69
+ _id?: string;
70
+ id?: string;
71
+ title?: string;
72
+ lang?: string;
73
+ model?: IAIModel;
74
+ assets?: IAgentAssets;
75
+ characterCard?: ICharacterCardDC;
76
+ conversationSettings?: IConversationSettings;
77
+ tts?: ITTS;
78
+ metaApp?: IAgentMetadata;
79
+ accounts?: Array<IAccounts>;
80
+ }
81
+ export declare enum EAccountsPlatform {
82
+ Tiktok = "tiktok",
83
+ Instagram = "instagram",
84
+ Youtube = "youtube"
85
+ }
86
+ export interface IAccounts {
87
+ platform: EAccountsPlatform;
88
+ user: string;
89
+ email: string;
90
+ authMethod: string;
91
+ pass: string;
92
+ }
93
+ export interface IMiniAgentCard {
94
+ task: string;
95
+ messages: ChatMessage[];
96
+ expectedResponseType: string;
97
+ model: IAIModel;
98
+ sources: string[];
99
+ }
100
+ export type TranscriptionsWhisper = {
101
+ text: string;
102
+ task: string;
103
+ language: string;
104
+ words: any;
105
+ duration: number;
106
+ };
107
+ export declare class WordTimestamps {
108
+ word: string;
109
+ start: number;
110
+ end: number;
111
+ highlighted: any;
112
+ }
113
+ export declare class ChatMultiMessage {
114
+ voice: string;
115
+ content: string;
116
+ text: string;
117
+ audioUrl: string;
118
+ audioPromise: any;
119
+ isLoading?: boolean;
120
+ transcription?: any;
121
+ transcriptionTimestamps?: WordTimestamps[];
122
+ tag: string | string[] | Set<string> | {
123
+ [klass: string]: any;
124
+ };
125
+ }
126
+ export declare enum ChatRole {
127
+ System = "system",
128
+ User = "user",
129
+ Assistant = "assistant",
130
+ AssistantHelper = "assistantHelper"
131
+ }
132
+ export declare class ChatMessage {
133
+ content: string;
134
+ role: ChatRole;
135
+ ssml?: string;
136
+ text?: string;
137
+ translation?: string;
138
+ audioUrl?: string;
139
+ audioHtml?: HTMLAudioElement;
140
+ promisePlay?: any;
141
+ stats?: any;
142
+ multiMessages?: ChatMultiMessage[];
143
+ transcription?: TranscriptionsWhisper;
144
+ transcriptionTimestamps?: WordTimestamps[];
145
+ voice?: string;
146
+ }
147
+ export declare class ChatUserSettings {
148
+ realTime: boolean;
149
+ superHearing: boolean;
150
+ repeatRecording: boolean;
151
+ fixGrammar: boolean;
152
+ voice?: string;
153
+ autoTranslate?: boolean;
154
+ highlightWords?: boolean;
155
+ synthVoice?: boolean;
156
+ model?: IAIModel;
157
+ speed?: AudioSpeed;
158
+ speedRate?: number;
159
+ }
160
+ export declare class ConversationMessagesDTO {
161
+ messages?: ChatMessage[];
162
+ modelName?: string;
163
+ provider?: string;
164
+ type?: ConversationType;
165
+ }
166
+ export declare class ConversationDTO {
167
+ id?: string;
168
+ entityId?: string;
169
+ type?: ConversationType;
170
+ createdAt?: Date;
171
+ messages: Array<ChatMessage>;
172
+ transcription?: boolean;
173
+ modelName?: string;
174
+ provider?: string;
175
+ returnJson?: boolean;
176
+ }
177
+ export interface ModelName {
178
+ id: string;
179
+ name: string;
180
+ }
181
+ export type AudioGenerated = {
182
+ blobUrl: string;
183
+ transcription: any;
184
+ };
185
+ export type TTSRequest = {
186
+ text: string;
187
+ voice: string;
188
+ generateTranscription: boolean;
189
+ speedRate: number;
190
+ speed?: string;
191
+ ssml?: string;
192
+ };
@@ -0,0 +1 @@
1
+ export declare function extractJsonFromResponse(content: string): any;
@@ -0,0 +1,27 @@
1
+ import { InjectionToken, Type } from '@angular/core';
2
+ import { Provider } from '@angular/core';
3
+ import { ChatUserSettings, IAgentCard, ModelName, IConversationSettingsDTO, IAgentResponseDTO } from './agent.models';
4
+ import { FiltersConfig, IFilterQueryResponse } from '@dataclouder/ngx-core';
5
+ export declare const CONVERSATION_AI_TOKEN: InjectionToken<AgentCardsAbstractService>;
6
+ export declare abstract class AgentCardsAbstractService {
7
+ abstract callChatCompletion(conversation: IConversationSettingsDTO): Promise<IAgentResponseDTO>;
8
+ abstract findConversationCardByID(id: string): Promise<IAgentCard>;
9
+ abstract filterConversationCards(filters: FiltersConfig): Promise<{
10
+ rows: IAgentCard[];
11
+ count: number;
12
+ skip: number;
13
+ }>;
14
+ abstract getAllConversationCards(): Promise<IAgentCard[]>;
15
+ abstract findFilteredAgentCards(paginator: FiltersConfig): Promise<IFilterQueryResponse<IAgentCard>>;
16
+ abstract findAgentCardByTitle(title: string): Promise<IAgentCard>;
17
+ abstract saveConversationCard(conversation: IAgentCard): Promise<IAgentCard>;
18
+ abstract deleteConversationCard(id: string): Promise<IAgentCard>;
19
+ abstract getTextAudioFile(tts: any): Promise<any>;
20
+ abstract getConversationUserChatSettings(): Promise<ChatUserSettings>;
21
+ abstract getListModels(provider: string): Promise<ModelName[]>;
22
+ abstract translateConversation(currentLang: string, targetLang: string, id: string): Promise<ChatUserSettings>;
23
+ abstract getAudioTranscriptions(audio: any, options: any): Promise<any>;
24
+ abstract callInstruction(prompt: string, IAIModel: any): Promise<any>;
25
+ abstract saveConversationUserChatSettings(conversation: ChatUserSettings): Promise<ChatUserSettings>;
26
+ }
27
+ export declare function provideChatAIService(serviceImplementation: Type<AgentCardsAbstractService>): Provider[];
@@ -0,0 +1,47 @@
1
+ export declare const LangCodeDescriptionEs: {
2
+ es: string;
3
+ en: string;
4
+ it: string;
5
+ pt: string;
6
+ fr: string;
7
+ };
8
+ export declare class VoiceTTSOption {
9
+ provider: string;
10
+ name: string;
11
+ id: string;
12
+ gender: 'male' | 'female';
13
+ lang: string;
14
+ exampleUrl: string;
15
+ }
16
+ export declare const VoiceTTSOptions: VoiceTTSOption[];
17
+ export declare enum AudioSpeed {
18
+ VerySlow = "verySlow",
19
+ Slow = "slow",
20
+ Regular = "regular",
21
+ Fast = "fast",
22
+ VeryFast = "veryFast"
23
+ }
24
+ export declare enum TextEngines {
25
+ SimpleText = "simpleText",
26
+ MarkdownMultiMessages = "markdownMultiMessages",
27
+ MarkdownSSML = "markdownSSML"
28
+ }
29
+ export declare const TextEngineOptions: {
30
+ value: TextEngines;
31
+ label: string;
32
+ }[];
33
+ export declare enum ConversationType {
34
+ Default = "default",
35
+ General = "general",
36
+ Reflection = "reflection",
37
+ Challenge = "challenge",
38
+ RolePlay = "rolePlay",
39
+ RolePlayNoNarrator = "rolePlayNoNarrator",
40
+ RolePlayInnerThoughts = "rolePlayInnerThoughts",
41
+ LearningExample = "learningExample",
42
+ Scenario = "scenario"
43
+ }
44
+ export declare const ConversationTypeOptions: {
45
+ value: ConversationType;
46
+ label: string;
47
+ }[];
@@ -0,0 +1,15 @@
1
+ export declare function getCharacterData(file: any): Promise<any>;
2
+ /**
3
+ * Extracts a JSON object from a PNG file.
4
+ * Taken from https://github.com/LostRuins/lite.koboldai.net/blob/main/index.html
5
+ * Adapted from png-chunks-extract under MIT license
6
+ * @param {Uint8Array} data The PNG data to extract the JSON from.
7
+ * @param {string} identifier The identifier to look for in the PNG tEXT data.
8
+ * @returns {object} The extracted JSON object.
9
+ */
10
+ export declare function extractDataFromPng(data: any, identifier?: string): any;
11
+ /**
12
+ * Returns a promise that resolves to the file's array buffer.
13
+ * @param {Blob} file The file to read.
14
+ */
15
+ export declare function getFileBuffer(file: any): Promise<unknown>;
@@ -0,0 +1,16 @@
1
+ import { InjectionToken, Provider, Type } from '@angular/core';
2
+ export interface UserDataExchange {
3
+ name: string;
4
+ gender: string;
5
+ age: number;
6
+ baseLang?: string;
7
+ targetLang?: string;
8
+ }
9
+ export declare const USER_DATA_EXCHANGE: InjectionToken<UserDataExchange>;
10
+ export declare function provideUserDataExchange(serviceImplementation: Type<UserDataExchangeAbstractService>): Provider[];
11
+ export declare abstract class UserDataExchangeAbstractService {
12
+ abstract getUserDataExchange(): UserDataExchange;
13
+ abstract getParseDict(): {
14
+ [key: string]: string;
15
+ };
16
+ }
@@ -0,0 +1,18 @@
1
+ import { PipeTransform } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare function markdownToHTML(markdownText: any): any;
4
+ export declare class SimpleMdToHtmlPipe implements PipeTransform {
5
+ transform(text: string): string;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<SimpleMdToHtmlPipe, never>;
7
+ static ɵpipe: i0.ɵɵPipeDeclaration<SimpleMdToHtmlPipe, "simpleMdToHtml", true>;
8
+ }
9
+ export declare class StartDivToHtmlPipe implements PipeTransform {
10
+ transform(text: string): string;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<StartDivToHtmlPipe, never>;
12
+ static ɵpipe: i0.ɵɵPipeDeclaration<StartDivToHtmlPipe, "startDividerToHtml", true>;
13
+ }
14
+ export declare class MdToHtmlArrayPipe implements PipeTransform {
15
+ transform(text: string): string;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<MdToHtmlArrayPipe, never>;
17
+ static ɵpipe: i0.ɵɵPipeDeclaration<MdToHtmlArrayPipe, "mdToHtmlArray", true>;
18
+ }
@@ -0,0 +1,14 @@
1
+ import { PipeTransform } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare const SpeedDescription: {
4
+ 1: string;
5
+ 2: string;
6
+ 3: string;
7
+ 4: string;
8
+ 5: string;
9
+ };
10
+ export declare class SpeedDescPipe implements PipeTransform {
11
+ transform(speed: any): string;
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<SpeedDescPipe, never>;
13
+ static ɵpipe: i0.ɵɵPipeDeclaration<SpeedDescPipe, "speedDisplay", true>;
14
+ }
@@ -0,0 +1,7 @@
1
+ import { PipeTransform } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class TruncatePipe implements PipeTransform {
4
+ transform(value: string, length?: number, suffix?: string): string;
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<TruncatePipe, never>;
6
+ static ɵpipe: i0.ɵɵPipeDeclaration<TruncatePipe, "truncate", true>;
7
+ }
@@ -0,0 +1,27 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class AudioService {
3
+ private currentAudio;
4
+ playFinishRecordingAudio(): void;
5
+ playFinishRecordingAudio2(): void;
6
+ playReflectionAudio(): void;
7
+ playAudio(audioUrl: string): HTMLAudioElement;
8
+ stopAudio(): void;
9
+ private successAudio;
10
+ private mistakeAudio;
11
+ private writtngAudio;
12
+ private coinAudio;
13
+ private noValid;
14
+ constructor();
15
+ playSuccess(): void;
16
+ playNoValid(): void;
17
+ playMistake(): Promise<void>;
18
+ playWriting(): void;
19
+ playCoins(n: number): void;
20
+ play2Coins(): Promise<void>;
21
+ play3Coins(): Promise<void>;
22
+ playWithSrc(source: any): Promise<void>;
23
+ getSpeedRate(speed: any): number;
24
+ playAudioWithStoragePath(path: string): Promise<void>;
25
+ static ɵfac: i0.ɵɵFactoryDeclaration<AudioService, never>;
26
+ static ɵprov: i0.ɵɵInjectableDeclaration<AudioService>;
27
+ }
@@ -0,0 +1,27 @@
1
+ import { ChatMessage, IConversationSettings, IAgentCard } from '../models/agent.models';
2
+ import { UserDataExchangeAbstractService } from '../models/user-data-exchange';
3
+ import * as i0 from "@angular/core";
4
+ export declare class DCConversationPromptBuilderService {
5
+ private userDataExchange;
6
+ constructor(userDataExchange: UserDataExchangeAbstractService);
7
+ buildConversationSettings(agentCard: IAgentCard, parseDict?: {
8
+ [key: string]: string;
9
+ }): IConversationSettings;
10
+ buildConversationMessages(agentCard: IAgentCard, parseDict?: {
11
+ [key: string]: string;
12
+ }): ChatMessage[];
13
+ private getDefaultParseDict;
14
+ convertConversationToHtml(messages: ChatMessage[], jailBrake?: string): string;
15
+ private parseConversation;
16
+ private applyReplacements;
17
+ private getDefaultPromptByType;
18
+ private buildInitialConversation;
19
+ private selectOneRandomGreeting;
20
+ private sampleSize;
21
+ getJailBrakePrompt(conversation: IAgentCard, parseDict?: {
22
+ [key: string]: string;
23
+ }): string;
24
+ getConversationSettings(agent: IAgentCard, chatMessages: ChatMessage[], jailBrakePrompt: string): IConversationSettings;
25
+ static ɵfac: i0.ɵɵFactoryDeclaration<DCConversationPromptBuilderService, never>;
26
+ static ɵprov: i0.ɵɵInjectableDeclaration<DCConversationPromptBuilderService>;
27
+ }
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@dataclouder/ngx-agent-cards",
3
+ "version": "0.0.75",
4
+ "peerDependencies": {
5
+ "@angular/common": ">=18.0.0",
6
+ "@angular/core": ">=18.0.0",
7
+ "@angular/cdk": ">=18.0.0",
8
+ "@dataclouder/ngx-cloud-storage": ">=0.0.4",
9
+ "@dataclouder/ngx-core": ">=0.0.1",
10
+ "@dataclouder/ngx-mic": ">=0.0.1",
11
+ "primeng": ">=19.0.0"
12
+ },
13
+ "depedencies": {
14
+ "@dataclouder/ngx-cloud-storage": ">=0.0.2"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "dependencies": {
20
+ "tslib": "^2.3.0"
21
+ },
22
+ "peerDependenciesMeta": {
23
+ "@dataclouder/ngx-cloud-storage": {
24
+ "optional": true
25
+ },
26
+ "@dataclouder/ngx-core": {
27
+ "optional": true
28
+ },
29
+ "@dataclouder/ngx-mic": {
30
+ "optional": true
31
+ }
32
+ },
33
+ "sideEffects": false,
34
+ "module": "fesm2022/dataclouder-ngx-agent-cards.mjs",
35
+ "typings": "index.d.ts",
36
+ "exports": {
37
+ "./package.json": {
38
+ "default": "./package.json"
39
+ },
40
+ ".": {
41
+ "types": "./index.d.ts",
42
+ "default": "./fesm2022/dataclouder-ngx-agent-cards.mjs"
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,15 @@
1
+ export * from './lib/models/agent.models';
2
+ export * from './lib/models/conversation-ai.class';
3
+ export * from './lib/models/conversation-enums';
4
+ export * from './lib/services/audio.service';
5
+ export * from './lib/services/dc-conversation-builder.service';
6
+ export * from './lib/components/chat-message/chat-message.component';
7
+ export * from './lib/components/chat/dc-chat.component';
8
+ export * from './lib/components/dc-agent-form/dc-agent-card-form.component';
9
+ export * from './lib/components/dc-agent-card-lists/dc-agent-card-lists.component';
10
+ export * from './lib/components/dc-agent-card-details/dc-agent-card-details.component';
11
+ export * from './lib/components/dc-agent-card-lists/agent-card-default-ui/agent-card-default-ui.component';
12
+ export * from './lib/models/user-data-exchange';
13
+ export * from './lib/components/dc-agent-card-lists/dc-agent-card-lists.component';
14
+ export * from './lib/components/provider-selector/provider-selector.component';
15
+ export * from './lib/models/agent.utils';