fmode-ng 0.0.16 → 0.0.18
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/esm2020/lib/aigc/avatar/comp-avatar-role-image/comp-avatar-role-image.component.mjs +1 -1
- package/esm2020/lib/aigc/avatar/comp-avatar-talk/comp-avatar-talk.component.mjs +1 -1
- package/esm2020/lib/aigc/avatar/index.mjs +1 -1
- package/esm2020/lib/aigc/avatar/modal-chat-voice-input/modal-chat-voice-input.component.mjs +10 -0
- package/esm2020/lib/aigc/service-fmai/service-chat/chat-class.mjs +1 -1
- package/esm2020/lib/aigc/service-fmai/service-chat/chat.service.mjs +1 -1
- package/esm2020/lib/aigc/service-fmai/service-chat/index.mjs +1 -1
- package/esm2020/lib/aigc/service-fmai/service-chat/pipes/hidexml.pipe.mjs +10 -0
- package/esm2020/lib/aigc/voice/tts/fmode-tts-class.mjs +10 -0
- package/esm2020/lib/aigc/voice/tts/index.mjs +10 -0
- package/esm2020/lib/platform/cross.service.mjs +1 -1
- package/fesm2015/fmode-ng.mjs +1 -1
- package/fesm2015/fmode-ng.mjs.map +1 -1
- package/fesm2020/fmode-ng.mjs +1 -1
- package/fesm2020/fmode-ng.mjs.map +1 -1
- package/lib/aigc/avatar/comp-avatar-role-image/comp-avatar-role-image.component.d.ts +7 -4
- package/lib/aigc/avatar/comp-avatar-talk/comp-avatar-talk.component.d.ts +6 -38
- package/lib/aigc/avatar/index.d.ts +1 -0
- package/lib/aigc/avatar/modal-chat-voice-input/modal-chat-voice-input.component.d.ts +63 -0
- package/lib/aigc/service-fmai/service-chat/chat-class.d.ts +32 -2
- package/lib/aigc/service-fmai/service-chat/index.d.ts +1 -0
- package/lib/aigc/service-fmai/service-chat/pipes/hidexml.pipe.d.ts +12 -0
- package/lib/aigc/voice/tts/fmode-tts-class.d.ts +33 -0
- package/lib/aigc/voice/tts/index.d.ts +1 -0
- package/lib/platform/cross.service.d.ts +1 -0
- package/package.json +8 -8
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import { AfterViewInit, ElementRef } from '@angular/core';
|
|
1
|
+
import { AfterViewInit, OnInit, ElementRef } from '@angular/core';
|
|
2
2
|
import { FmodeAvatarRoleComp } from '../interface-avatar-role';
|
|
3
3
|
import 'recorder-core/src/extensions/waveview';
|
|
4
4
|
import Parse from "parse";
|
|
5
|
+
import { FmodeChat } from '../../service-fmai/service-chat/chat-class';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
|
-
export declare class CompAvatarRoleImageComponent implements FmodeAvatarRoleComp, AfterViewInit {
|
|
7
|
+
export declare class CompAvatarRoleImageComponent implements FmodeAvatarRoleComp, AfterViewInit, OnInit {
|
|
7
8
|
avatarImage: ElementRef;
|
|
8
9
|
animClass: string;
|
|
10
|
+
fmodeChat: FmodeChat;
|
|
9
11
|
role: Parse.Object;
|
|
10
12
|
wave: any;
|
|
11
13
|
waveInterval: any;
|
|
12
14
|
playWave(): void;
|
|
13
15
|
stopWave(): void;
|
|
14
16
|
ngAfterViewInit(): void;
|
|
15
|
-
|
|
17
|
+
ngOnInit(): void;
|
|
18
|
+
playAnimation(): (name: string) => void;
|
|
16
19
|
static ɵfac: i0.ɵɵFactoryDeclaration<CompAvatarRoleImageComponent, never>;
|
|
17
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<CompAvatarRoleImageComponent, "fm-avatar-role-image", never, { "role": "role"; }, {}, never, never, true, never>;
|
|
20
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CompAvatarRoleImageComponent, "fm-avatar-role-image", never, { "fmodeChat": "fmodeChat"; "role": "role"; }, {}, never, never, true, never>;
|
|
18
21
|
}
|
|
@@ -5,6 +5,8 @@ import { FmodeAvatarRoleComp } from '../interface-avatar-role';
|
|
|
5
5
|
import { NavController, Platform } from "@ionic/angular";
|
|
6
6
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
7
7
|
import * as Parse from "parse";
|
|
8
|
+
import { NovaCloudService } from '../../../nova-cloud/nova-cloud.service';
|
|
9
|
+
import { FmodeChat } from '../../service-fmai/service-chat';
|
|
8
10
|
import * as i0 from "@angular/core";
|
|
9
11
|
export declare class CompAvatarTalkComponent implements AfterViewInit, OnDestroy {
|
|
10
12
|
voiceServ: FmodeVoiceService;
|
|
@@ -13,54 +15,20 @@ export declare class CompAvatarTalkComponent implements AfterViewInit, OnDestroy
|
|
|
13
15
|
private navCtrl;
|
|
14
16
|
private route;
|
|
15
17
|
chatServ: ChatService;
|
|
18
|
+
private ncloud;
|
|
16
19
|
avatarComp: FmodeAvatarRoleComp;
|
|
17
20
|
roleId: string;
|
|
18
21
|
avatarRole: Parse.Object;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* @default click
|
|
22
|
-
*/
|
|
23
|
-
talkMode: "click" | "press";
|
|
24
|
-
talkTips: string;
|
|
25
|
-
constructor(voiceServ: FmodeVoiceService, platform: Platform, router: Router, navCtrl: NavController, route: ActivatedRoute, chatServ: ChatService);
|
|
26
|
-
/**
|
|
27
|
-
* 初始化录音转录服务
|
|
28
|
-
* @desc
|
|
29
|
-
* 根据数字角色对话状态,设计语音转录各事件处理过程
|
|
30
|
-
* 嵌入提示音
|
|
31
|
-
* 嵌入动画
|
|
32
|
-
* 嵌入唤醒词切换逻辑
|
|
33
|
-
*/
|
|
34
|
-
initVoiceSevice(): void;
|
|
22
|
+
fmodeChat: FmodeChat;
|
|
23
|
+
constructor(voiceServ: FmodeVoiceService, platform: Platform, router: Router, navCtrl: NavController, route: ActivatedRoute, chatServ: ChatService, ncloud: NovaCloudService);
|
|
35
24
|
ngOnInit(): void;
|
|
36
25
|
ngOnDestroy(): void;
|
|
37
26
|
goBack(): void;
|
|
38
27
|
loadAvatarRole(roleId: any): Promise<void>;
|
|
39
|
-
player: HTMLAudioElement;
|
|
40
|
-
playMusic(action: any): void;
|
|
41
28
|
ngAfterViewInit(): void;
|
|
42
29
|
aiRespComp: ElementRef;
|
|
43
30
|
listenDivChange(): void;
|
|
44
31
|
scrollToBottom(comp: ElementRef): void;
|
|
45
|
-
initAvatar(): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* AI响应内容
|
|
48
|
-
*/
|
|
49
|
-
aiResponseText: string;
|
|
50
|
-
/**
|
|
51
|
-
* 发送消息逻辑
|
|
52
|
-
*/
|
|
53
|
-
sendMessage(): void;
|
|
54
|
-
/**
|
|
55
|
-
* ASR - 唤醒词
|
|
56
|
-
*/
|
|
57
|
-
startASRAwake(): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* TTS - 语音合成
|
|
60
|
-
*
|
|
61
|
-
*/
|
|
62
|
-
testTTS(sentence?: any): void;
|
|
63
|
-
testXunfeiTTS(): void;
|
|
64
32
|
static ɵfac: i0.ɵɵFactoryDeclaration<CompAvatarTalkComponent, never>;
|
|
65
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<CompAvatarTalkComponent, "app-comp-avatar-talk", never, {
|
|
33
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CompAvatarTalkComponent, "app-comp-avatar-talk", never, {}, {}, never, never, true, never>;
|
|
66
34
|
}
|
|
@@ -3,3 +3,4 @@ export * from "./interface-avatar-role";
|
|
|
3
3
|
export * from "./comp-avatar-particle";
|
|
4
4
|
export * from "./comp-avatar-role-image/comp-avatar-role-image.component";
|
|
5
5
|
export * from "./comp-avatar-talk/comp-avatar-talk.component";
|
|
6
|
+
export * from "./modal-chat-voice-input/modal-chat-voice-input.component";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { ToastController } from "@ionic/angular";
|
|
3
|
+
import { Router } from '@angular/router';
|
|
4
|
+
import { Platform } from "@ionic/angular";
|
|
5
|
+
import { FmodeVoiceService } from '../../voice';
|
|
6
|
+
import { FmodeChat, ChatService } from '../../service-fmai/service-chat';
|
|
7
|
+
import { FmodeTTS } from '../../voice/tts';
|
|
8
|
+
import { NovaCloudService } from '../../../nova-cloud/nova-cloud.service';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
export declare class ModalChatVoiceInputComponent implements OnInit {
|
|
11
|
+
private platform;
|
|
12
|
+
private router;
|
|
13
|
+
voiceServ: FmodeVoiceService;
|
|
14
|
+
private toastCtrl;
|
|
15
|
+
private ncloud;
|
|
16
|
+
chatServ: ChatService;
|
|
17
|
+
fmodeChat: FmodeChat | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* 开始讲话方式:click点击开始/点击结束 press按住讲话/松开结束
|
|
20
|
+
* @default click
|
|
21
|
+
*/
|
|
22
|
+
talkMode: "click" | "press";
|
|
23
|
+
talkTips: string;
|
|
24
|
+
errorText: string;
|
|
25
|
+
constructor(platform: Platform, router: Router, voiceServ: FmodeVoiceService, toastCtrl: ToastController, ncloud: NovaCloudService, chatServ: ChatService);
|
|
26
|
+
ngOnInit(): void;
|
|
27
|
+
/**
|
|
28
|
+
* ASR唤醒功能
|
|
29
|
+
*/
|
|
30
|
+
initVoiceASR(): Promise<void>;
|
|
31
|
+
startASRAwake(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* 音频提示音播放
|
|
34
|
+
*/
|
|
35
|
+
player: HTMLAudioElement;
|
|
36
|
+
playMusic(action: any): void;
|
|
37
|
+
/**
|
|
38
|
+
* 初始化录音转录服务
|
|
39
|
+
* @desc
|
|
40
|
+
* 根据数字角色对话状态,设计语音转录各事件处理过程
|
|
41
|
+
* 嵌入提示音
|
|
42
|
+
* 嵌入动画
|
|
43
|
+
* 嵌入唤醒词切换逻辑
|
|
44
|
+
*/
|
|
45
|
+
initVoiceSevice(): void;
|
|
46
|
+
/**
|
|
47
|
+
* 发送语音消息
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
sendMessage(): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* TTS - 语音合成
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
tts: FmodeTTS;
|
|
56
|
+
initTTS(): Promise<void>;
|
|
57
|
+
playTTS(textOrSSML: string): Promise<void>;
|
|
58
|
+
playTTSTeting(): void;
|
|
59
|
+
testTTS(sentence?: any): void;
|
|
60
|
+
testXunfeiTTS(): void;
|
|
61
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ModalChatVoiceInputComponent, never>;
|
|
62
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ModalChatVoiceInputComponent, "fm-modal-chat-voice-input", never, { "fmodeChat": "fmodeChat"; "talkMode": "talkMode"; }, {}, never, never, true, never>;
|
|
63
|
+
}
|
|
@@ -30,12 +30,41 @@ export declare class FmodeChat {
|
|
|
30
30
|
chatSession: Parse.Object;
|
|
31
31
|
role: any;
|
|
32
32
|
messageList: FmodeChatMessage[];
|
|
33
|
+
latestAIResponse: string | undefined;
|
|
33
34
|
chatServ: any;
|
|
34
35
|
userInput: string;
|
|
35
36
|
userImage: string;
|
|
37
|
+
/**
|
|
38
|
+
* 是否开启语音对话模式
|
|
39
|
+
* @desc
|
|
40
|
+
* 开启ssml system提示词
|
|
41
|
+
* 开启回答文本除xml显示模式
|
|
42
|
+
*/
|
|
43
|
+
isTalkMode: boolean;
|
|
44
|
+
SSMLRoleVoice: string;
|
|
36
45
|
constructor(sessionId: string, role?: Parse.Object, chatSession?: Parse.Object, chatServ?: any);
|
|
37
|
-
|
|
38
|
-
|
|
46
|
+
/**
|
|
47
|
+
* 会话Avatar控制
|
|
48
|
+
*/
|
|
49
|
+
playAnimation: (animName: string) => void;
|
|
50
|
+
/**
|
|
51
|
+
* 对话模型提示词
|
|
52
|
+
*/
|
|
53
|
+
loadTalkSystemPrompt(role: Parse.Object): void;
|
|
54
|
+
/**
|
|
55
|
+
* 角色提示词
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
loadRolePrompt(): void;
|
|
59
|
+
/**
|
|
60
|
+
* 发送消息
|
|
61
|
+
* @param message
|
|
62
|
+
* @param imageUrl
|
|
63
|
+
*/
|
|
64
|
+
sendMessage(message?: string, imageUrl?: string, onComplete?: Function): void;
|
|
65
|
+
/**
|
|
66
|
+
* 保存单次会话
|
|
67
|
+
*/
|
|
39
68
|
saveChatSession(): Promise<void>;
|
|
40
69
|
getInviteUrl(url: any): any;
|
|
41
70
|
genTitle(): string;
|
|
@@ -69,5 +98,6 @@ export declare class FmodeChatCompletion {
|
|
|
69
98
|
sendCompletion(options?: {
|
|
70
99
|
isDirect?: boolean;
|
|
71
100
|
intTime?: number;
|
|
101
|
+
onComplete?: Function;
|
|
72
102
|
}): Observable<FmodeChatMessage>;
|
|
73
103
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* 文字生成过程中 xml格式标签自动隐藏 用于语音对话答复字符显示
|
|
5
|
+
* @desc
|
|
6
|
+
*/
|
|
7
|
+
export declare class HidexmlPipe implements PipeTransform {
|
|
8
|
+
transform(value: string, ...args: unknown[]): unknown;
|
|
9
|
+
hideXmlTags(xmlString: any): any;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HidexmlPipe, never>;
|
|
11
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<HidexmlPipe, "hidexml", true>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FmodeTTS
|
|
3
|
+
* 每个类,表示一次独立的语音合成服务
|
|
4
|
+
*/
|
|
5
|
+
export declare class FmodeTTS {
|
|
6
|
+
private speechConfig;
|
|
7
|
+
private audioConfig;
|
|
8
|
+
private synthesizer;
|
|
9
|
+
private subscriptionKey;
|
|
10
|
+
private authorizationToken;
|
|
11
|
+
private region;
|
|
12
|
+
constructor(config: {
|
|
13
|
+
region: string;
|
|
14
|
+
subscriptionKey: string;
|
|
15
|
+
token: string;
|
|
16
|
+
});
|
|
17
|
+
extractSSMLContent(inputString: any): any;
|
|
18
|
+
/**
|
|
19
|
+
* 合成语言并播放
|
|
20
|
+
* @param textOrSSML
|
|
21
|
+
* @desc
|
|
22
|
+
* 普通文本
|
|
23
|
+
* SSML https://learn.microsoft.com/zh-cn/azure/ai-services/speech-service/how-to-speech-synthesis?tabs=browserjs%2Cterminal&pivots=programming-language-javascript#use-ssml-to-customize-speech-characteristics
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
speakAsync(textOrSSML: string): Promise<void>;
|
|
27
|
+
onBreak(options: {
|
|
28
|
+
playedTime: string;
|
|
29
|
+
playedText: string;
|
|
30
|
+
leftText: string;
|
|
31
|
+
}): void;
|
|
32
|
+
playAudioData(audioData: any): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./fmode-tts-class";
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fmode-ng",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"author": "未来全栈",
|
|
5
5
|
"license": "COPYRIGHT © 未来飞马 未来全栈 www.fmode.cn All RIGHTS RESERVED",
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"@angular/common": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
8
|
-
"@angular/core": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
9
|
-
"@angular/forms": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
10
|
-
"@angular/animations": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
11
|
-
"@capacitor/clipboard": "
|
|
12
|
-
"ng-zorro-antd": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
7
|
+
"@angular/common": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
8
|
+
"@angular/core": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
9
|
+
"@angular/forms": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
10
|
+
"@angular/animations": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
11
|
+
"@capacitor/clipboard": "^6.0.0 || ^7.0.0",
|
|
12
|
+
"ng-zorro-antd": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
13
13
|
"parse": "^5.0.0",
|
|
14
14
|
"@types/parse": "^3.0.9",
|
|
15
|
-
"@ionic/angular": "^6.0.0 || ^7.0.0",
|
|
15
|
+
"@ionic/angular": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",
|
|
16
16
|
"qiniu-js": "^3.4.1",
|
|
17
17
|
"recorder-core": "^1.2.23070100",
|
|
18
18
|
"@amap/amap-jsapi-loader": "^1.0.1",
|