fmode-ng 0.0.83 → 0.0.85
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/esm2022/lib/aigc/avatar/comp-avatar-talk/comp-avatar-talk.component.mjs +1 -1
- package/esm2022/lib/aigc/avatar/modal-chat-voice-input/modal-chat-voice-input.component.mjs +1 -1
- package/esm2022/lib/aigc/chat/chat-header-area/comp-header-area.component.mjs +1 -1
- package/esm2022/lib/aigc/chat/chat-message-card/comp-message-card.component.mjs +1 -1
- package/esm2022/lib/aigc/chat/chat-modal-input/modal-audio-message/modal-audio-message.component.mjs +1 -1
- package/esm2022/lib/aigc/chat/chat-modal-input/modal-input.component.mjs +1 -1
- package/esm2022/lib/aigc/chat/chat-panel/chat-panel.component.mjs +1 -1
- package/esm2022/lib/aigc/index.mjs +1 -1
- package/esm2022/lib/aigc/story/fm-office-viewer/fm-office-viewer.component.mjs +10 -0
- package/esm2022/lib/aigc/story/fm-story-card/fm-story-card.component.mjs +10 -0
- package/esm2022/lib/aigc/story/fm-story-list/fm-story-list.component.mjs +10 -0
- package/esm2022/lib/aigc/story/fm-story-list/story-preview.mjs +10 -0
- package/esm2022/lib/aigc/story/fm-story-loader/fm-story-loader.component.mjs +10 -0
- package/esm2022/lib/aigc/story/fm-story-splitter/fm-story-splitter.component.mjs +10 -0
- package/esm2022/lib/aigc/story/index.mjs +10 -0
- package/esm2022/lib/aigc/story/modal-chat-story/comp-chat-story-json/comp-chat-story-json.component.mjs +10 -0
- package/esm2022/lib/aigc/story/modal-chat-story/comp-diary-story/comp-diary-story.component.mjs +10 -0
- package/esm2022/lib/aigc/story/modal-chat-story/modal-chat-story.component.mjs +10 -0
- package/esm2022/lib/aigc/story/story.service.mjs +10 -0
- package/esm2022/lib/aigc/voice/fmode-voice.service.mjs +1 -1
- package/esm2022/lib/aigc/voice/index.mjs +1 -1
- package/esm2022/lib/aigc/voice/{audio.player.mjs → lib/audio/audio.player.mjs} +2 -2
- package/esm2022/lib/aigc/voice/lib/audio/audio.streamer.mjs +10 -0
- package/esm2022/lib/aigc/voice/lib/audio/streamer.microsoft.mjs +10 -0
- package/esm2022/lib/aigc/voice/lib/audio/streamer.pcm.mjs +10 -0
- package/esm2022/lib/aigc/voice/tts/fmode-tts-class.mjs +1 -1
- package/esm2022/lib/aigc/voice/tts/index.mjs +1 -1
- package/esm2022/lib/aigc/voice/tts/int-tts-provider.mjs +10 -0
- package/esm2022/lib/aigc/voice/tts/provider-doubao.mjs +10 -0
- package/esm2022/lib/aigc/voice/tts/provider-microsoft.mjs +10 -0
- package/esm2022/lib/core/agent/chat/completion/fmode-completion.mjs +1 -1
- package/esm2022/lib/core/agent/chat/completion/int-gpt-chat-options.mjs +10 -0
- package/esm2022/lib/core/agent/chat/fmode-chat.mjs +1 -1
- package/esm2022/lib/core/agent/chat/index.mjs +1 -1
- package/esm2022/lib/core/agent/prompt/agent.prompt.mjs +1 -1
- package/esm2022/lib/core/index.mjs +10 -0
- package/esm2022/lib/core/voice/index.mjs +10 -0
- package/esm2022/lib/icon/filetype/audio.svg.mjs +10 -0
- package/esm2022/lib/icon/filetype/avatar.svg.mjs +10 -0
- package/esm2022/lib/icon/filetype/chat.svg.mjs +10 -0
- package/esm2022/lib/icon/filetype/docx.svg.mjs +10 -0
- package/esm2022/lib/icon/filetype/file.svg.mjs +10 -0
- package/esm2022/lib/icon/filetype/filetype.pipe.mjs +10 -0
- package/esm2022/lib/icon/filetype/index.mjs +10 -0
- package/esm2022/lib/icon/filetype/md.svg.mjs +10 -0
- package/esm2022/lib/icon/filetype/pdf.svg.mjs +10 -0
- package/esm2022/lib/icon/filetype/pptx.svg.mjs +10 -0
- package/esm2022/lib/icon/filetype/svgtoblob.mjs +10 -0
- package/esm2022/lib/icon/filetype/video.svg.mjs +10 -0
- package/esm2022/lib/icon/filetype/xlsx.svg.mjs +10 -0
- package/esm2022/lib/icon/index.mjs +10 -0
- package/esm2022/lib/person/comp-person-gender-icon/comp-person-gender-icon.component.mjs +10 -0
- package/esm2022/lib/person/comp-person-item/comp-person-item.component.mjs +10 -0
- package/esm2022/lib/person/comp-person-story/comp-person-story.component.mjs +10 -0
- package/esm2022/lib/person/edit-upload/edit-upload.component.mjs +10 -0
- package/esm2022/lib/person/edit-upload/edit-upload.module.mjs +10 -0
- package/esm2022/lib/person/index.mjs +10 -0
- package/esm2022/lib/person/modal-person-select/modal-person-select.component.mjs +10 -0
- package/esm2022/lib/person/modal-user-verify/secret-text.pipe.mjs +10 -0
- package/esm2022/lib/person/modal-user-verify/user-verify.component.mjs +10 -0
- package/esm2022/lib/person/person-detail/person-detail.component.mjs +10 -0
- package/esm2022/lib/person/person.service.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/article-editor-topbar/article-editor-topbar.component.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/article.service.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/comp-upload-book-banners/comp-upload-book-banners.component.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/draft.service.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/fm-article-aitool/fm-article-aitool.component.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/fm-article-draft/fm-article-draft.component.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/fm-article-editor.component.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/fm-article-outline/fm-article-outline.component.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/fm-article-outline-leftitem/fm-article-outline-leftitem.component.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/fm-article-preview/fm-article-preview.component.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/fm-article-write-options/fm-article-write-options.component.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/outline-count.pipe.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/prompt/prompt-insertion-article.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/task-article-generation.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/tasks/task-article-draft-create.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/tasks/task-article-outline-edit.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/tasks/task-article-outline.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/tasks/task-article-preview.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/tasks/task-article-writing-options.mjs +10 -0
- package/esm2022/lib/text/fm-article-editor/tasks/task-document-select.mjs +10 -0
- package/esm2022/lib/text/fm-text-quill/fm-text-quill.component.mjs +10 -0
- package/esm2022/lib/text/index.mjs +10 -0
- package/esm2022/public-api.mjs +1 -1
- package/fesm2022/fmode-ng.mjs +1 -1
- package/fesm2022/fmode-ng.mjs.map +1 -1
- package/lib/aigc/avatar/comp-avatar-talk/comp-avatar-talk.component.d.ts +5 -3
- package/lib/aigc/avatar/modal-chat-voice-input/modal-chat-voice-input.component.d.ts +4 -2
- package/lib/aigc/chat/chat-message-card/comp-message-card.component.d.ts +6 -1
- package/lib/aigc/chat/chat-modal-input/modal-audio-message/modal-audio-message.component.d.ts +6 -3
- package/lib/aigc/chat/chat-modal-input/modal-input.component.d.ts +5 -1
- package/lib/aigc/index.d.ts +1 -0
- package/lib/aigc/story/fm-office-viewer/fm-office-viewer.component.d.ts +23 -0
- package/lib/aigc/story/fm-story-card/fm-story-card.component.d.ts +26 -0
- package/lib/aigc/story/fm-story-list/fm-story-list.component.d.ts +71 -0
- package/lib/aigc/story/fm-story-list/story-preview.d.ts +20 -0
- package/lib/aigc/story/fm-story-loader/fm-story-loader.component.d.ts +38 -0
- package/lib/aigc/story/fm-story-splitter/fm-story-splitter.component.d.ts +13 -0
- package/lib/aigc/story/index.d.ts +5 -0
- package/lib/aigc/story/modal-chat-story/comp-chat-story-json/comp-chat-story-json.component.d.ts +14 -0
- package/lib/aigc/story/modal-chat-story/comp-diary-story/comp-diary-story.component.d.ts +29 -0
- package/lib/aigc/story/modal-chat-story/modal-chat-story.component.d.ts +44 -0
- package/lib/aigc/story/story.service.d.ts +12 -0
- package/lib/aigc/voice/fmode-voice.service.d.ts +3 -6
- package/lib/aigc/voice/index.d.ts +3 -2
- package/lib/aigc/voice/lib/audio/audio.streamer.d.ts +33 -0
- package/lib/aigc/voice/{stream.player.d.ts → lib/audio/streamer.microsoft.d.ts} +2 -2
- package/lib/aigc/voice/lib/audio/streamer.pcm.d.ts +45 -0
- package/lib/aigc/voice/tts/fmode-tts-class.d.ts +17 -37
- package/lib/aigc/voice/tts/index.d.ts +3 -0
- package/lib/aigc/voice/tts/int-tts-provider.d.ts +35 -0
- package/lib/aigc/voice/tts/provider-doubao.d.ts +43 -0
- package/lib/aigc/voice/tts/provider-microsoft.d.ts +21 -0
- package/lib/core/agent/chat/completion/fmode-completion.d.ts +2 -1
- package/lib/core/agent/chat/completion/int-gpt-chat-options.d.ts +72 -0
- package/lib/core/agent/chat/index.d.ts +1 -1
- package/lib/core/agent/chat/interface.d.ts +3 -0
- package/lib/core/agent/prompt/agent.prompt.d.ts +2 -1
- package/lib/core/index.d.ts +2 -0
- package/lib/core/voice/index.d.ts +1 -0
- package/lib/icon/filetype/audio.svg.d.ts +1 -0
- package/lib/icon/filetype/avatar.svg.d.ts +1 -0
- package/lib/icon/filetype/chat.svg.d.ts +1 -0
- package/lib/icon/filetype/docx.svg.d.ts +1 -0
- package/lib/icon/filetype/file.svg.d.ts +1 -0
- package/lib/icon/filetype/filetype.pipe.d.ts +8 -0
- package/lib/icon/filetype/index.d.ts +11 -0
- package/lib/icon/filetype/md.svg.d.ts +1 -0
- package/lib/icon/filetype/pdf.svg.d.ts +1 -0
- package/lib/icon/filetype/pptx.svg.d.ts +1 -0
- package/lib/icon/filetype/svgtoblob.d.ts +1 -0
- package/lib/icon/filetype/video.svg.d.ts +1 -0
- package/lib/icon/filetype/xlsx.svg.d.ts +1 -0
- package/lib/icon/index.d.ts +1 -0
- package/lib/person/comp-person-gender-icon/comp-person-gender-icon.component.d.ts +20 -0
- package/lib/person/comp-person-item/comp-person-item.component.d.ts +10 -0
- package/lib/person/comp-person-story/comp-person-story.component.d.ts +67 -0
- package/lib/person/edit-upload/edit-upload.component.d.ts +81 -0
- package/lib/person/edit-upload/edit-upload.module.d.ts +11 -0
- package/lib/person/index.d.ts +4 -0
- package/lib/person/modal-person-select/modal-person-select.component.d.ts +25 -0
- package/lib/person/modal-user-verify/secret-text.pipe.d.ts +7 -0
- package/lib/person/modal-user-verify/user-verify.component.d.ts +88 -0
- package/lib/person/person-detail/person-detail.component.d.ts +41 -0
- package/lib/person/person.service.d.ts +33 -0
- package/lib/text/fm-article-editor/article-editor-topbar/article-editor-topbar.component.d.ts +23 -0
- package/lib/text/fm-article-editor/article.service.d.ts +41 -0
- package/lib/text/fm-article-editor/comp-upload-book-banners/comp-upload-book-banners.component.d.ts +19 -0
- package/lib/text/fm-article-editor/draft.service.d.ts +33 -0
- package/lib/text/fm-article-editor/fm-article-aitool/fm-article-aitool.component.d.ts +73 -0
- package/lib/text/fm-article-editor/fm-article-draft/fm-article-draft.component.d.ts +81 -0
- package/lib/text/fm-article-editor/fm-article-editor.component.d.ts +90 -0
- package/lib/text/fm-article-editor/fm-article-outline/fm-article-outline.component.d.ts +36 -0
- package/lib/text/fm-article-editor/fm-article-outline-leftitem/fm-article-outline-leftitem.component.d.ts +12 -0
- package/lib/text/fm-article-editor/fm-article-preview/fm-article-preview.component.d.ts +55 -0
- package/lib/text/fm-article-editor/fm-article-write-options/fm-article-write-options.component.d.ts +31 -0
- package/lib/text/fm-article-editor/outline-count.pipe.d.ts +7 -0
- package/lib/text/fm-article-editor/prompt/prompt-insertion-article.d.ts +6 -0
- package/lib/text/fm-article-editor/task-article-generation.d.ts +23 -0
- package/lib/text/fm-article-editor/tasks/task-article-draft-create.d.ts +18 -0
- package/lib/text/fm-article-editor/tasks/task-article-outline-edit.d.ts +14 -0
- package/lib/text/fm-article-editor/tasks/task-article-outline.d.ts +19 -0
- package/lib/text/fm-article-editor/tasks/task-article-preview.d.ts +7 -0
- package/lib/text/fm-article-editor/tasks/task-article-writing-options.d.ts +14 -0
- package/lib/text/fm-article-editor/tasks/task-document-select.d.ts +14 -0
- package/lib/text/fm-text-quill/fm-text-quill.component.d.ts +39 -0
- package/lib/text/index.d.ts +3 -0
- package/package.json +6 -2
- package/public-api.d.ts +4 -0
- package/esm2022/lib/aigc/voice/lib/recorder/engine-pcm.mjs +0 -10
- package/esm2022/lib/aigc/voice/lib/recorder/engine-wav.mjs +0 -10
- package/esm2022/lib/aigc/voice/stream.player.mjs +0 -10
- package/lib/aigc/voice/lib/recorder/engine-pcm.d.ts +0 -1
- package/lib/aigc/voice/lib/recorder/engine-wav.d.ts +0 -1
- /package/lib/aigc/voice/{audio.player.d.ts → lib/audio/audio.player.d.ts} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
|
+
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
|
+
* 保留所有权利 All Rights Reserved.
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/story/modal-chat-story/comp-chat-story-json/comp-chat-story-json.component.mjs
|
|
7
|
+
*/
|
|
8
|
+
import{CommonModule}from"@angular/common";import{Component,Input}from"@angular/core";import{FormsModule,ReactiveFormsModule}from"@angular/forms";import{MatButtonModule}from"@angular/material/button";import{IonItem,IonLabel,IonIcon,IonCardSubtitle,IonCardContent,IonList,IonCard,IonCardTitle,IonNote,IonCardHeader,IonItemGroup,IonItemDivider,IonChip,IonTextarea,ModalController}from"@ionic/angular/standalone";import{NzPipesModule}from"ng-zorro-antd/pipes";import{FiletypePipe}from"../../../../icon/filetype";import*as i0 from"@angular/core";import*as i1 from"@ionic/angular/standalone";import*as i2 from"@angular/common";import*as i3 from"@angular/forms";import*as i4 from"@angular/material/button";export class CompChatStoryJsonComponent{constructor(n){this.modalCtrl=n,this.showHeader=!1}back(){this.modalCtrl.dismiss()}ngOnInit(){this.story?.get("person")?.id&&this.story?.get("person")?.get("name")&&(this.person=this.story?.get("person"))}static{this.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:CompChatStoryJsonComponent,deps:[{token:i1.ModalController}],target:i0.ɵɵFactoryTarget.Component})}static{this.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"17.0.0",version:"17.3.12",type:CompChatStoryJsonComponent,isStandalone:!0,selector:"comp-chat-story-json",inputs:{story:"story",person:"person",showHeader:"showHeader"},ngImport:i0,template:'@if(showHeader){\n <div class="filebar">\n \x3c!-- 文件信息 --\x3e\n <div class="file-info" style="display:flex;align-items:center;">\n \x3c!-- 图标+大小 --\x3e\n <ion-icon [src]="\'.chat\'|filetype"></ion-icon>\n <span class="size">{{story?.get("chatSession")?.get("messageList")?.length }}条</span>\n </div>\n \x3c!-- 标题 --\x3e\n <div class="title">\n {{story?.get("title")||\'未命名\'}}\n </div>\n \x3c!-- 操作区域 --\x3e\n <div class="actions" style="display:flex;align-items:center;justify-content: flex-end;">\n \x3c!-- 关闭 --\x3e\n <button mat-button (click)="back()" aria-label="预览">\n 关闭\n </button>\n </div>\n</div>\n}\n<ng-container *ngIf="story?.get(\'contentJson\')">\n <div [style.overflowY]="\'auto\'">\n\n \x3c!-- 采访主题 --\x3e\n <ion-item>\n <ion-label>主题</ion-label>\n {{story?.get(\'contentJson\')?.title}}\n </ion-item>\n <ion-item>\n <ion-label>标签</ion-label>\n <ion-chip *ngFor="let item of story?.get(\'contentJson\')?.keywords" color="success">{{item}}</ion-chip>\n </ion-item>\n <ion-item>\n <ion-textarea label="概述" [readonly]="true" [autoGrow]="true" [ngModel]="story?.get(\'contentJson\')?.desc"></ion-textarea>\n </ion-item>\n\n \x3c!-- 话题卡片 --\x3e\n <ion-list>\n <ion-card color="primary" *ngFor="let topic of story?.get(\'contentJson\')?.topics||[];let index = index;">\n <ion-card-header>\n <ion-card-title>话题{{index+1}}.{{ topic.title }}</ion-card-title>\n <ion-card-subtitle><ion-chip *ngFor="let item of topic.keywords" color="warning">{{item}}</ion-chip></ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <p>{{ topic.content }}</p>\n <ion-list>\n <ng-container *ngFor="let qa of topic.list">\n <ion-item >\n <ion-note slot="start" color="medium">\n 问\n </ion-note>\n <ion-label>\n {{ qa.q }}\n </ion-label>\n </ion-item>\n <ion-item >\n <ion-label>\n {{ qa.a }}\n </ion-label>\n <ion-note slot="end" color="medium">\n 答\n </ion-note>\n </ion-item>\n </ng-container>\n \n </ion-list>\n </ion-card-content>\n </ion-card>\n </ion-list>\n <ion-list>\n <ion-item-group *ngIf="person">\n <ion-item>\n <ion-label style="text-align:center;">延伸问题</ion-label>\n </ion-item>\n <ion-item *ngFor="let item of story?.get(\'contentJson\')?.questions||[];let index = index;">\n {{index+1}}{{item}}\n </ion-item>\n </ion-item-group>\n </ion-list>\n</div>\n\n</ng-container>',styles:[".filebar{display:flex;justify-content:space-between;align-items:center;padding:5px 15px}.filebar .file-info{max-width:80px}.filebar .title{flex:1;font-weight:700;margin-left:5px;margin-right:5px;max-width:220px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;text-align:center}.filebar mat-card-content{color:#333}.filebar ion-icon{font-size:28px;min-width:30px}.filebar ion-chip{color:#333}.filebar .actions{max-width:104px}\n"],dependencies:[{kind:"ngmodule",type:CommonModule},{kind:"directive",type:i2.NgForOf,selector:"[ngFor][ngForOf]",inputs:["ngForOf","ngForTrackBy","ngForTemplate"]},{kind:"directive",type:i2.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]},{kind:"ngmodule",type:FormsModule},{kind:"directive",type:i3.NgControlStatus,selector:"[formControlName],[ngModel],[formControl]"},{kind:"directive",type:i3.NgModel,selector:"[ngModel]:not([formControlName]):not([formControl])",inputs:["name","disabled","ngModel","ngModelOptions"],outputs:["ngModelChange"],exportAs:["ngModel"]},{kind:"ngmodule",type:ReactiveFormsModule},{kind:"component",type:IonItem,selector:"ion-item",inputs:["button","color","detail","detailIcon","disabled","download","href","lines","mode","rel","routerAnimation","routerDirection","target","type"]},{kind:"component",type:IonLabel,selector:"ion-label",inputs:["color","mode","position"]},{kind:"component",type:IonIcon,selector:"ion-icon",inputs:["color","flipRtl","icon","ios","lazy","md","mode","name","sanitize","size","src"]},{kind:"component",type:IonList,selector:"ion-list",inputs:["inset","lines","mode"]},{kind:"component",type:IonCard,selector:"ion-card",inputs:["button","color","disabled","download","href","mode","rel","routerAnimation","routerDirection","target","type"]},{kind:"component",type:IonCardHeader,selector:"ion-card-header",inputs:["color","mode","translucent"]},{kind:"component",type:IonCardTitle,selector:"ion-card-title",inputs:["color","mode"]},{kind:"component",type:IonCardSubtitle,selector:"ion-card-subtitle",inputs:["color","mode"]},{kind:"component",type:IonCardContent,selector:"ion-card-content",inputs:["mode"]},{kind:"component",type:IonNote,selector:"ion-note",inputs:["color","mode"]},{kind:"component",type:IonItemGroup,selector:"ion-item-group"},{kind:"component",type:IonChip,selector:"ion-chip",inputs:["color","disabled","mode","outline"]},{kind:"component",type:IonTextarea,selector:"ion-textarea",inputs:["autoGrow","autocapitalize","autofocus","clearOnEdit","color","cols","counter","counterFormatter","debounce","disabled","enterkeyhint","errorText","fill","helperText","inputmode","label","labelPlacement","maxlength","minlength","mode","name","placeholder","readonly","required","rows","shape","spellcheck","value","wrap"]},{kind:"ngmodule",type:MatButtonModule},{kind:"component",type:i4.MatButton,selector:" button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ",exportAs:["matButton"]},{kind:"ngmodule",type:NzPipesModule},{kind:"pipe",type:FiletypePipe,name:"filetype"}]})}}i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:CompChatStoryJsonComponent,decorators:[{type:Component,args:[{selector:"comp-chat-story-json",standalone:!0,imports:[CommonModule,FormsModule,ReactiveFormsModule,IonItem,IonLabel,IonIcon,IonList,IonCard,IonCardHeader,IonCardTitle,IonCardSubtitle,IonCardContent,IonNote,IonItemGroup,IonItemDivider,IonChip,IonTextarea,MatButtonModule,NzPipesModule,FiletypePipe],template:'@if(showHeader){\n <div class="filebar">\n \x3c!-- 文件信息 --\x3e\n <div class="file-info" style="display:flex;align-items:center;">\n \x3c!-- 图标+大小 --\x3e\n <ion-icon [src]="\'.chat\'|filetype"></ion-icon>\n <span class="size">{{story?.get("chatSession")?.get("messageList")?.length }}条</span>\n </div>\n \x3c!-- 标题 --\x3e\n <div class="title">\n {{story?.get("title")||\'未命名\'}}\n </div>\n \x3c!-- 操作区域 --\x3e\n <div class="actions" style="display:flex;align-items:center;justify-content: flex-end;">\n \x3c!-- 关闭 --\x3e\n <button mat-button (click)="back()" aria-label="预览">\n 关闭\n </button>\n </div>\n</div>\n}\n<ng-container *ngIf="story?.get(\'contentJson\')">\n <div [style.overflowY]="\'auto\'">\n\n \x3c!-- 采访主题 --\x3e\n <ion-item>\n <ion-label>主题</ion-label>\n {{story?.get(\'contentJson\')?.title}}\n </ion-item>\n <ion-item>\n <ion-label>标签</ion-label>\n <ion-chip *ngFor="let item of story?.get(\'contentJson\')?.keywords" color="success">{{item}}</ion-chip>\n </ion-item>\n <ion-item>\n <ion-textarea label="概述" [readonly]="true" [autoGrow]="true" [ngModel]="story?.get(\'contentJson\')?.desc"></ion-textarea>\n </ion-item>\n\n \x3c!-- 话题卡片 --\x3e\n <ion-list>\n <ion-card color="primary" *ngFor="let topic of story?.get(\'contentJson\')?.topics||[];let index = index;">\n <ion-card-header>\n <ion-card-title>话题{{index+1}}.{{ topic.title }}</ion-card-title>\n <ion-card-subtitle><ion-chip *ngFor="let item of topic.keywords" color="warning">{{item}}</ion-chip></ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n <p>{{ topic.content }}</p>\n <ion-list>\n <ng-container *ngFor="let qa of topic.list">\n <ion-item >\n <ion-note slot="start" color="medium">\n 问\n </ion-note>\n <ion-label>\n {{ qa.q }}\n </ion-label>\n </ion-item>\n <ion-item >\n <ion-label>\n {{ qa.a }}\n </ion-label>\n <ion-note slot="end" color="medium">\n 答\n </ion-note>\n </ion-item>\n </ng-container>\n \n </ion-list>\n </ion-card-content>\n </ion-card>\n </ion-list>\n <ion-list>\n <ion-item-group *ngIf="person">\n <ion-item>\n <ion-label style="text-align:center;">延伸问题</ion-label>\n </ion-item>\n <ion-item *ngFor="let item of story?.get(\'contentJson\')?.questions||[];let index = index;">\n {{index+1}}{{item}}\n </ion-item>\n </ion-item-group>\n </ion-list>\n</div>\n\n</ng-container>',styles:[".filebar{display:flex;justify-content:space-between;align-items:center;padding:5px 15px}.filebar .file-info{max-width:80px}.filebar .title{flex:1;font-weight:700;margin-left:5px;margin-right:5px;max-width:220px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;text-align:center}.filebar mat-card-content{color:#333}.filebar ion-icon{font-size:28px;min-width:30px}.filebar ion-chip{color:#333}.filebar .actions{max-width:104px}\n"]}]}],ctorParameters:()=>[{type:i1.ModalController}],propDecorators:{story:[{type:Input}],person:[{type:Input}],showHeader:[{type:Input}]}});
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3N0b3J5L21vZGFsLWNoYXQtc3RvcnkvY29tcC1jaGF0LXN0b3J5LWpzb24vY29tcC1jaGF0LXN0b3J5LWpzb24uY29tcG9uZW50Lm1qcw==`
|
|
10
|
+
|
package/esm2022/lib/aigc/story/modal-chat-story/comp-diary-story/comp-diary-story.component.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
|
+
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
|
+
* 保留所有权利 All Rights Reserved.
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/story/modal-chat-story/comp-diary-story/comp-diary-story.component.mjs
|
|
7
|
+
*/
|
|
8
|
+
import{CommonModule}from"@angular/common";import{ChangeDetectorRef,Component,Input}from"@angular/core";import{FormsModule,ReactiveFormsModule}from"@angular/forms";import{MatButtonModule}from"@angular/material/button";import{IonItem,IonLabel,IonIcon,IonCardSubtitle,IonCardContent,IonList,IonCard,IonCardTitle,IonNote,IonCardHeader,IonItemGroup,IonItemDivider,IonChip,IonTextarea,ModalController,IonButton}from"@ionic/angular/standalone";import{NzPipesModule}from"ng-zorro-antd/pipes";import{FiletypePipe}from"../../../../icon/filetype";import{FmTextQuillComponent}from"../../../../text/fm-text-quill/fm-text-quill.component";import{CompPersonItemComponent}from"../../../../person";import*as i0 from"@angular/core";import*as i1 from"@ionic/angular/standalone";import*as i2 from"@angular/common";import*as i3 from"@angular/forms";import*as i4 from"@angular/material/button";export class CompDiaryStoryComponent{constructor(e,n){this.modalCtrl=e,this.cdRef=n,this.showHeader=!1,this.readOnly=!1,this.contentChanged=!1,this.showInfo=!1,this.now=new Date,this.toolbar=[[{header:[1,2,3,4,!1]}],["bold","italic","underline"],[{list:"bullet"}],[{align:[]}]],this.selectText=""}back(){this.modalCtrl.dismiss()}ngOnInit(){this.story?.get("person")?.id&&this.story?.get("person")?.get("name")&&(this.person=this.story?.get("person"))}selectChange(e){this.selectRange=e?.range,this.selectText=e?.text,this.selectQuill=e?.quill,this.cdRef.detectChanges()}goOptimizeText(e){this.selectChange(e)}setContent(e,n){n?n.content=e:this.story?.set("content",e),this.contentChanged=!0}save(){this.contentChanged=!1,this.story?.save()}static{this.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:CompDiaryStoryComponent,deps:[{token:i1.ModalController},{token:i0.ChangeDetectorRef}],target:i0.ɵɵFactoryTarget.Component})}static{this.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"17.0.0",version:"17.3.12",type:CompDiaryStoryComponent,isStandalone:!0,selector:"comp-diary-story",inputs:{story:"story",person:"person",showHeader:"showHeader",readOnly:"readOnly"},ngImport:i0,template:'@if(showHeader){\n <div class="filebar">\n \x3c!-- 文件信息 --\x3e\n <div class="file-info" style="display:flex;align-items:center;">\n \x3c!-- 图标+大小 --\x3e\n <ion-icon [src]="\'.chat\'|filetype"></ion-icon>\n <span class="size">{{story?.get("chatSession")?.get("messageList")?.length }}条</span>\n </div>\n \x3c!-- 标题 --\x3e\n <div class="title">\n {{story?.get("title")||\'未命名\'}}\n </div>\n \x3c!-- 操作区域 --\x3e\n <div class="actions" style="display:flex;align-items:center;justify-content: flex-end;">\n \x3c!-- 关闭 --\x3e\n <button mat-button (click)="back()" aria-label="预览">\n 关闭\n </button>\n </div>\n</div>\n}\n<ng-container *ngIf="story?.get(\'contentJson\')">\n <div [style.overflowY]="\'auto\'">\n\n @if(showInfo){\n\n @if(person?.id){\n <fm-comp-person-item [person]="person"></fm-comp-person-item>\n }\n \x3c!-- 采访主题 --\x3e\n \x3c!-- <ion-item>\n <ion-label>主题</ion-label>\n {{story?.get(\'contentJson\')?.title}}\n </ion-item> --\x3e\n <ion-item>\n <ion-label>日期</ion-label>\n {{(story?.get("recordDate") || now) | date:"yy/MM/dd HH:mm"}}\n </ion-item>\n <ion-item>\n <ion-label>标签</ion-label>\n <ion-chip *ngFor="let item of story?.get(\'contentJson\')?.keywords" color="success">{{item}}</ion-chip>\n </ion-item>\n <ion-item>\n <ion-textarea label="概述" [readonly]="true" [autoGrow]="true" [ngModel]="story?.get(\'contentJson\')?.desc"></ion-textarea>\n </ion-item>\n }\n\n <ion-list>\n <ion-item-group>\n <ion-item>\n <ion-label style="position: absolute;left: 0;width:50px;">主题</ion-label>\n <ion-label style="text-align:center;">{{story?.get(\'contentJson\')?.title}}</ion-label>\n <ion-button (click)="showInfo=!showInfo" style="position: absolute;right: 0;">{{showInfo?"折叠":"展开"}}</ion-button>\n <ion-button *ngIf="contentChanged" (click)="save()" style="position: absolute;right: 0;" [style.marginRight]="showInfo?\'50px\':\'0px\'">保存</ion-button>\n </ion-item>\n </ion-item-group>\n @if(story?.get(\'content\')){\n <fm-text-quill #textQuill [theme]="\'snow\'" [toolbar]="toolbar" [readOnly]="readOnly" [content]="story?.get(\'content\')" (onContentChange)="setContent($event)"\n (onAIClick)="goOptimizeText($event)" (onSelectChange)="selectChange($event)"\n ></fm-text-quill>\n }\n </ion-list>\n</div>\n\n</ng-container>',styles:[".filebar{display:flex;justify-content:space-between;align-items:center;padding:5px 15px}.filebar .file-info{max-width:80px}.filebar .title{flex:1;font-weight:700;margin-left:5px;margin-right:5px;max-width:220px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;text-align:center}.filebar mat-card-content{color:#333}.filebar ion-icon{font-size:28px;min-width:30px}.filebar ion-chip{color:#333}.filebar .actions{max-width:104px}\n"],dependencies:[{kind:"ngmodule",type:CommonModule},{kind:"directive",type:i2.NgForOf,selector:"[ngFor][ngForOf]",inputs:["ngForOf","ngForTrackBy","ngForTemplate"]},{kind:"directive",type:i2.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]},{kind:"pipe",type:i2.DatePipe,name:"date"},{kind:"ngmodule",type:FormsModule},{kind:"directive",type:i3.NgControlStatus,selector:"[formControlName],[ngModel],[formControl]"},{kind:"directive",type:i3.NgModel,selector:"[ngModel]:not([formControlName]):not([formControl])",inputs:["name","disabled","ngModel","ngModelOptions"],outputs:["ngModelChange"],exportAs:["ngModel"]},{kind:"ngmodule",type:ReactiveFormsModule},{kind:"component",type:IonItem,selector:"ion-item",inputs:["button","color","detail","detailIcon","disabled","download","href","lines","mode","rel","routerAnimation","routerDirection","target","type"]},{kind:"component",type:IonLabel,selector:"ion-label",inputs:["color","mode","position"]},{kind:"component",type:IonIcon,selector:"ion-icon",inputs:["color","flipRtl","icon","ios","lazy","md","mode","name","sanitize","size","src"]},{kind:"component",type:IonList,selector:"ion-list",inputs:["inset","lines","mode"]},{kind:"component",type:IonItemGroup,selector:"ion-item-group"},{kind:"component",type:IonChip,selector:"ion-chip",inputs:["color","disabled","mode","outline"]},{kind:"component",type:IonButton,selector:"ion-button",inputs:["buttonType","color","disabled","download","expand","fill","form","href","mode","rel","routerAnimation","routerDirection","shape","size","strong","target","type"]},{kind:"component",type:IonTextarea,selector:"ion-textarea",inputs:["autoGrow","autocapitalize","autofocus","clearOnEdit","color","cols","counter","counterFormatter","debounce","disabled","enterkeyhint","errorText","fill","helperText","inputmode","label","labelPlacement","maxlength","minlength","mode","name","placeholder","readonly","required","rows","shape","spellcheck","value","wrap"]},{kind:"ngmodule",type:MatButtonModule},{kind:"component",type:i4.MatButton,selector:" button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ",exportAs:["matButton"]},{kind:"ngmodule",type:NzPipesModule},{kind:"pipe",type:FiletypePipe,name:"filetype"},{kind:"component",type:FmTextQuillComponent,selector:"fm-text-quill",inputs:["readOnly","content","theme","toolbar"],outputs:["onAIClick","onContentChange","onSelectChange"]},{kind:"component",type:CompPersonItemComponent,selector:"fm-comp-person-item",inputs:["person"]}]})}}i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:CompDiaryStoryComponent,decorators:[{type:Component,args:[{selector:"comp-diary-story",standalone:!0,imports:[CommonModule,FormsModule,ReactiveFormsModule,IonItem,IonLabel,IonIcon,IonList,IonCard,IonCardHeader,IonCardTitle,IonCardSubtitle,IonCardContent,IonNote,IonItemGroup,IonItemDivider,IonChip,IonButton,IonTextarea,MatButtonModule,NzPipesModule,FiletypePipe,FmTextQuillComponent,CompPersonItemComponent],template:'@if(showHeader){\n <div class="filebar">\n \x3c!-- 文件信息 --\x3e\n <div class="file-info" style="display:flex;align-items:center;">\n \x3c!-- 图标+大小 --\x3e\n <ion-icon [src]="\'.chat\'|filetype"></ion-icon>\n <span class="size">{{story?.get("chatSession")?.get("messageList")?.length }}条</span>\n </div>\n \x3c!-- 标题 --\x3e\n <div class="title">\n {{story?.get("title")||\'未命名\'}}\n </div>\n \x3c!-- 操作区域 --\x3e\n <div class="actions" style="display:flex;align-items:center;justify-content: flex-end;">\n \x3c!-- 关闭 --\x3e\n <button mat-button (click)="back()" aria-label="预览">\n 关闭\n </button>\n </div>\n</div>\n}\n<ng-container *ngIf="story?.get(\'contentJson\')">\n <div [style.overflowY]="\'auto\'">\n\n @if(showInfo){\n\n @if(person?.id){\n <fm-comp-person-item [person]="person"></fm-comp-person-item>\n }\n \x3c!-- 采访主题 --\x3e\n \x3c!-- <ion-item>\n <ion-label>主题</ion-label>\n {{story?.get(\'contentJson\')?.title}}\n </ion-item> --\x3e\n <ion-item>\n <ion-label>日期</ion-label>\n {{(story?.get("recordDate") || now) | date:"yy/MM/dd HH:mm"}}\n </ion-item>\n <ion-item>\n <ion-label>标签</ion-label>\n <ion-chip *ngFor="let item of story?.get(\'contentJson\')?.keywords" color="success">{{item}}</ion-chip>\n </ion-item>\n <ion-item>\n <ion-textarea label="概述" [readonly]="true" [autoGrow]="true" [ngModel]="story?.get(\'contentJson\')?.desc"></ion-textarea>\n </ion-item>\n }\n\n <ion-list>\n <ion-item-group>\n <ion-item>\n <ion-label style="position: absolute;left: 0;width:50px;">主题</ion-label>\n <ion-label style="text-align:center;">{{story?.get(\'contentJson\')?.title}}</ion-label>\n <ion-button (click)="showInfo=!showInfo" style="position: absolute;right: 0;">{{showInfo?"折叠":"展开"}}</ion-button>\n <ion-button *ngIf="contentChanged" (click)="save()" style="position: absolute;right: 0;" [style.marginRight]="showInfo?\'50px\':\'0px\'">保存</ion-button>\n </ion-item>\n </ion-item-group>\n @if(story?.get(\'content\')){\n <fm-text-quill #textQuill [theme]="\'snow\'" [toolbar]="toolbar" [readOnly]="readOnly" [content]="story?.get(\'content\')" (onContentChange)="setContent($event)"\n (onAIClick)="goOptimizeText($event)" (onSelectChange)="selectChange($event)"\n ></fm-text-quill>\n }\n </ion-list>\n</div>\n\n</ng-container>',styles:[".filebar{display:flex;justify-content:space-between;align-items:center;padding:5px 15px}.filebar .file-info{max-width:80px}.filebar .title{flex:1;font-weight:700;margin-left:5px;margin-right:5px;max-width:220px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;text-align:center}.filebar mat-card-content{color:#333}.filebar ion-icon{font-size:28px;min-width:30px}.filebar ion-chip{color:#333}.filebar .actions{max-width:104px}\n"]}]}],ctorParameters:()=>[{type:i1.ModalController},{type:i0.ChangeDetectorRef}],propDecorators:{story:[{type:Input}],person:[{type:Input}],showHeader:[{type:Input}],readOnly:[{type:Input}]}});
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3N0b3J5L21vZGFsLWNoYXQtc3RvcnkvY29tcC1kaWFyeS1zdG9yeS9jb21wLWRpYXJ5LXN0b3J5LmNvbXBvbmVudC5tanM=`
|
|
10
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
|
+
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
|
+
* 保留所有权利 All Rights Reserved.
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/story/modal-chat-story/modal-chat-story.component.mjs
|
|
7
|
+
*/
|
|
8
|
+
import{CommonModule}from"@angular/common";import{Component,Input}from"@angular/core";import{FormsModule,ReactiveFormsModule}from"@angular/forms";import{ActivatedRoute}from"@angular/router";import{AlertController,IonAvatar,IonButton,IonButtons,IonChip,IonContent,IonHeader,IonIcon,IonImg,IonItem,IonItemDivider,IonItemGroup,IonLabel,IonList,IonModal,IonSpinner,IonTextarea,IonTitle,IonToolbar,ModalController,NavController}from"@ionic/angular/standalone";import{AgentPrompt,FmodeChatCompletion,getMessageContentText,MarkdownPreviewModule}from"../../../aigc";import Parse from"parse";import{finalize}from"rxjs";import{PersonService}from"../../../person";import{CompPersonItemComponent}from"../../../person";import{CompDiaryStoryComponent}from"./comp-diary-story/comp-diary-story.component";import{CompChatStoryJsonComponent}from"./comp-chat-story-json/comp-chat-story-json.component";import{addIcons}from"ionicons";import{alertCircleOutline}from"ionicons/icons";import{openPersonSelectModal}from"../../../person";import*as i0 from"@angular/core";import*as i1 from"@ionic/angular/standalone";import*as i2 from"../../../person";import*as i3 from"@angular/router";import*as i4 from"@angular/common";const agentPrompt=new AgentPrompt,PromptTplSessionStoryCode="story-chat-session-tpl";addIcons({alertCircleOutline:alertCircleOutline});export class ModalChatStoryComponent{constructor(t,n,o,e,i){this.alertCtrl=t,this.modalCtrl=n,this.personServ=o,this.navCtrl=e,this.route=i,this.title="",this.subtitle="",this.desc="",this.promptTpl="story-chat-session-tpl",this.type="chat",this.now=new Date,this.isCreating=!1,this.Story=Parse.Object.extend("Story"),this.relationName="",this.defaultAvatar="/assets/img/icon/avatar.svg",this.summaryContent=""}ngOnInit(){this.loadPerson(),this.story?.id&&this.onBreakPointSet&&this.onBreakPointSet(.75)}async loadPerson(){let t=this.chatSession?.id||this.chatSession?.objectId;if(this.chatSession=await this.personServ.loadObjectById("ChatSession",t,["person","user","recorder","story"]),this.story=this.chatSession.get("story"),!this.person?.id){let t=(window.location.search?.replaceAll("?","")).split("&").find((t=>t.indexOf("pid=")>-1)),n=t?.split("=")?.[1];if(n){let t=new Parse.Query("Person");this.person=await t.get(n)}}this.person?.id||(this.person=this.story?.get("person")||this.story?.get("chatSession")?.get("person")),"Pointer"==this.person?.__type&&(this.person=await this.personServ.loadPersonById(this.person?.objectId)),this.relationName="朋友";let n=this.chatSession?.get("user")?.get("realname"),o=this.person?.get("name");o==n&&(this.relationName="本人")}async createStory(){let t=this.chatSession?.get("person")||this.person;t?.id||(t=await openPersonSelectModal(this.modalCtrl));let n=this.chatSession?.id||this.chatSession?.objectId;if(this.chatSession=await this.personServ.loadObjectById("ChatSession",n,["person","user","recorder"]),!this.chatSession?.id){return void(await this.alertCtrl.create({header:"当前会话未开始",message:"请聊一会儿再总结哦!"})).present()}this.isCreating=!0;let o=this.story||new this.Story;this.person&&o.set("person",this.person?.toPointer()),o.set("type",this.type),o.set("user",Parse.User.current());let e=await this.personServ.loadSelfPerson();o.set("chatSession",this.chatSession?.toPointer()),o.set("recorder",e),o.set("recordDate",this.chatSession?.createdAt);let i=this.chatSession.get("messageList"),s="",r=this.person?.get("name"),a=this.chatSession?.get("user")?.get("realname");i.forEach((t=>{if("system"==t?.role)return;let n="记者";"user"==t?.role&&(n=a);let o=getMessageContentText(t?.content);s+=`${n}:\n${o}\n`})),this.relationName="朋友",r==a&&(this.relationName="本人");let l=await agentPrompt.getFormatTpl(this.promptTpl,{personName:this.person?.get("name"),userName:a,relationName:this.relationName,messageRecord:s,createdAt:this.chatSession?.createdAt}),c=new FmodeChatCompletion([{role:"user",content:l}]);c.model="fmode-4.0-cn-256k";c.sendCompletion({isDirect:!0}).pipe(finalize((()=>{}))).subscribe((async t=>{if(this.summaryContent=t.content,t?.complete){let n=t?.content||"",i=agentPrompt.extractAndParseJson(n);o.set("title",i?.title),o.set("desc",i?.desc),o.set("keywords",i?.keywords),o.set("content",i?.content||""),delete i.content,o.set("contentJson",i),o=await o.save(),this.story=o;let s=this.person?.toPointer()||this.chatSession.get("person")?.toPointer&&this.chatSession.get("person")?.toPointer()||e?.toPointer();this.chatSession?.set("title",i?.title),this.chatSession?.set("story",o.toPointer()),s&&(console.log(s),this.chatSession?.set("person",s)),this.chatSession=await(this.chatSession?.save()),this.isCreating=!1,this.onCanDismiss&&this.onCanDismiss(!0),this.onBreakPointSet&&this.onBreakPointSet(.75)}}))}confirm(){this.modalCtrl.dismiss(null,"confirm"),window.location.pathname?.indexOf("chat/session")>-1&&this.navCtrl.back()}cancel(){this.modalCtrl.dismiss(null,"cancel"),window.location.pathname?.indexOf("chat/session")>-1&&this.navCtrl.back()}static{this.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:ModalChatStoryComponent,deps:[{token:i1.AlertController},{token:i1.ModalController},{token:i2.PersonService},{token:i1.NavController},{token:i3.ActivatedRoute}],target:i0.ɵɵFactoryTarget.Component})}static{this.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"17.0.0",version:"17.3.12",type:ModalChatStoryComponent,isStandalone:!0,selector:"app-modal-chat-story",inputs:{title:"title",subtitle:"subtitle",desc:"desc",promptTpl:"promptTpl",type:"type",isCreating:"isCreating",story:"story"},ngImport:i0,template:'<ion-header *ngIf="story?.id&&story?.get(\'contentJson\')">\n <ion-toolbar>\n <ion-buttons slot="start">\n <ion-button (click)="cancel()">返回</ion-button>\n </ion-buttons>\n <ion-title>{{title}}</ion-title>\n <ion-buttons slot="end">\n <ion-button (click)="confirm()" [strong]="true">确认</ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n \x3c!-- 提示:总结对话 --\x3e\n <ion-list *ngIf="!(story || chatSession?.get(\'story\'))?.get(\'contentJson\') && !isCreating">\n <ion-item>\n <ion-icon color="success" name="alert-circle-outline"></ion-icon>\n <ion-label>{{subtitle}}</ion-label>\n </ion-item>\n <ion-item>\n <ion-label>{{desc}}</ion-label>\n </ion-item>\n <div style="display:flex;justify-content: end;">\n <ion-button color="light" slot="end" (click)="cancel()">取消</ion-button>\n <ion-button style="margin-left:20px;" (click)="createStory()" color="success" slot="end">确认</ion-button>\n </div>\n </ion-list>\n\n\n \x3c!-- 加载:总结过程 --\x3e\n <div class="page" *ngIf="isCreating">\n <ion-spinner name="crescent" color="primary" style="width:80px;height:80px;"></ion-spinner>\n <ion-label color="primary">AI正在分析会话内容...</ion-label>\n <ion-label color="primary">{{(summaryContent?.length || 0)*1.5}} tokens</ion-label>\n \n </div>\n\n \x3c!-- 结果:总结后成果 --\x3e\n\n <ion-list *ngIf="(story || chatSession?.get(\'story\'))?.get(\'contentJson\')">\n @if(type=="diary"){\n <comp-diary-story [story]="story" [person]="person"></comp-diary-story>\n }\n @if(type==\'chat\'){\n <ion-item-group *ngIf="person?.id">\n <ion-item>\n <ion-label style="text-align:center;">话题人物</ion-label>\n </ion-item>\n \n <fm-comp-person-item [person]="person"></fm-comp-person-item>\n </ion-item-group>\n\n <ion-item-group>\n <ion-item>\n <ion-label style="text-align:center;">采访摘要</ion-label>\n </ion-item>\n </ion-item-group>\n\n <ion-item>\n <ion-label>采访日期</ion-label>\n {{(story?.get("recordDate") || now) | date:"yy/MM/dd HH:mm"}}\n </ion-item>\n <ion-item>\n <ion-label>被采访人</ion-label>\n {{story?.get("recorder")?.get("name")}} <ion-chip color="warning" *ngIf="relationName">{{relationName}}</ion-chip>\n </ion-item>\n <comp-chat-story-json [story]="story"></comp-chat-story-json>\n }\n \x3c!-- <ion-item>\n <fm-markdown-preview class="content" *ngIf="story?.get(\'content\')" [content]="story?.get(\'content\')"></fm-markdown-preview>\n </ion-item> --\x3e\n </ion-list>\n</ion-content>\n\n',styles:[".page{display:flex;justify-content:center;align-items:center;flex-direction:column}.content{filter:invert(1)!important}\n"],dependencies:[{kind:"ngmodule",type:CommonModule},{kind:"directive",type:i4.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]},{kind:"pipe",type:i4.DatePipe,name:"date"},{kind:"ngmodule",type:FormsModule},{kind:"ngmodule",type:ReactiveFormsModule},{kind:"component",type:IonHeader,selector:"ion-header",inputs:["collapse","mode","translucent"]},{kind:"component",type:IonTitle,selector:"ion-title",inputs:["color","size"]},{kind:"component",type:IonToolbar,selector:"ion-toolbar",inputs:["color","mode"]},{kind:"component",type:IonButtons,selector:"ion-buttons",inputs:["collapse"]},{kind:"component",type:IonContent,selector:"ion-content",inputs:["color","fixedSlotPlacement","forceOverscroll","fullscreen","scrollEvents","scrollX","scrollY"]},{kind:"component",type:IonLabel,selector:"ion-label",inputs:["color","mode","position"]},{kind:"component",type:IonButton,selector:"ion-button",inputs:["buttonType","color","disabled","download","expand","fill","form","href","mode","rel","routerAnimation","routerDirection","shape","size","strong","target","type"]},{kind:"component",type:IonIcon,selector:"ion-icon",inputs:["color","flipRtl","icon","ios","lazy","md","mode","name","sanitize","size","src"]},{kind:"component",type:IonList,selector:"ion-list",inputs:["inset","lines","mode"]},{kind:"component",type:IonItem,selector:"ion-item",inputs:["button","color","detail","detailIcon","disabled","download","href","lines","mode","rel","routerAnimation","routerDirection","target","type"]},{kind:"component",type:IonItemGroup,selector:"ion-item-group"},{kind:"component",type:IonSpinner,selector:"ion-spinner",inputs:["color","duration","name","paused"]},{kind:"component",type:IonChip,selector:"ion-chip",inputs:["color","disabled","mode","outline"]},{kind:"component",type:CompPersonItemComponent,selector:"fm-comp-person-item",inputs:["person"]},{kind:"ngmodule",type:MarkdownPreviewModule},{kind:"component",type:CompDiaryStoryComponent,selector:"comp-diary-story",inputs:["story","person","showHeader","readOnly"]},{kind:"component",type:CompChatStoryJsonComponent,selector:"comp-chat-story-json",inputs:["story","person","showHeader"]}]})}}i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:ModalChatStoryComponent,decorators:[{type:Component,args:[{selector:"app-modal-chat-story",standalone:!0,imports:[CommonModule,FormsModule,ReactiveFormsModule,IonHeader,IonTitle,IonToolbar,IonButtons,IonModal,IonContent,IonLabel,IonAvatar,IonImg,IonButton,IonIcon,IonList,IonItem,IonItemGroup,IonItemDivider,IonTextarea,IonSpinner,IonChip,CompPersonItemComponent,MarkdownPreviewModule,CompDiaryStoryComponent,CompChatStoryJsonComponent],template:'<ion-header *ngIf="story?.id&&story?.get(\'contentJson\')">\n <ion-toolbar>\n <ion-buttons slot="start">\n <ion-button (click)="cancel()">返回</ion-button>\n </ion-buttons>\n <ion-title>{{title}}</ion-title>\n <ion-buttons slot="end">\n <ion-button (click)="confirm()" [strong]="true">确认</ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class="ion-padding">\n\n \x3c!-- 提示:总结对话 --\x3e\n <ion-list *ngIf="!(story || chatSession?.get(\'story\'))?.get(\'contentJson\') && !isCreating">\n <ion-item>\n <ion-icon color="success" name="alert-circle-outline"></ion-icon>\n <ion-label>{{subtitle}}</ion-label>\n </ion-item>\n <ion-item>\n <ion-label>{{desc}}</ion-label>\n </ion-item>\n <div style="display:flex;justify-content: end;">\n <ion-button color="light" slot="end" (click)="cancel()">取消</ion-button>\n <ion-button style="margin-left:20px;" (click)="createStory()" color="success" slot="end">确认</ion-button>\n </div>\n </ion-list>\n\n\n \x3c!-- 加载:总结过程 --\x3e\n <div class="page" *ngIf="isCreating">\n <ion-spinner name="crescent" color="primary" style="width:80px;height:80px;"></ion-spinner>\n <ion-label color="primary">AI正在分析会话内容...</ion-label>\n <ion-label color="primary">{{(summaryContent?.length || 0)*1.5}} tokens</ion-label>\n \n </div>\n\n \x3c!-- 结果:总结后成果 --\x3e\n\n <ion-list *ngIf="(story || chatSession?.get(\'story\'))?.get(\'contentJson\')">\n @if(type=="diary"){\n <comp-diary-story [story]="story" [person]="person"></comp-diary-story>\n }\n @if(type==\'chat\'){\n <ion-item-group *ngIf="person?.id">\n <ion-item>\n <ion-label style="text-align:center;">话题人物</ion-label>\n </ion-item>\n \n <fm-comp-person-item [person]="person"></fm-comp-person-item>\n </ion-item-group>\n\n <ion-item-group>\n <ion-item>\n <ion-label style="text-align:center;">采访摘要</ion-label>\n </ion-item>\n </ion-item-group>\n\n <ion-item>\n <ion-label>采访日期</ion-label>\n {{(story?.get("recordDate") || now) | date:"yy/MM/dd HH:mm"}}\n </ion-item>\n <ion-item>\n <ion-label>被采访人</ion-label>\n {{story?.get("recorder")?.get("name")}} <ion-chip color="warning" *ngIf="relationName">{{relationName}}</ion-chip>\n </ion-item>\n <comp-chat-story-json [story]="story"></comp-chat-story-json>\n }\n \x3c!-- <ion-item>\n <fm-markdown-preview class="content" *ngIf="story?.get(\'content\')" [content]="story?.get(\'content\')"></fm-markdown-preview>\n </ion-item> --\x3e\n </ion-list>\n</ion-content>\n\n',styles:[".page{display:flex;justify-content:center;align-items:center;flex-direction:column}.content{filter:invert(1)!important}\n"]}]}],ctorParameters:()=>[{type:i1.AlertController},{type:i1.ModalController},{type:i2.PersonService},{type:i1.NavController},{type:i3.ActivatedRoute}],propDecorators:{title:[{type:Input}],subtitle:[{type:Input}],desc:[{type:Input}],promptTpl:[{type:Input}],type:[{type:Input}],isCreating:[{type:Input}],story:[{type:Input}]}});export async function openChatStoryModal(t,n,o){let e=n?.get("story"),i=.4;e?.id&&e?.get("contentJson")&&(i=.75);let s={chatSession:n,story:e,onBreakPointSet:t=>{r.setCurrentBreakpoint(t)},onCanDismiss:t=>{r.canDismiss=t}};s.type=o?.type||"chat",s.title=o?.title||"采访总结",s.subtitle=o?.subtitle||"任务: 总结分析本次对话",s.desc=o?.desc||"总结后的对话信息,将进入人物知识库,可被检索和选择。但不可继续聊天!您是否确认总结本次对话内容?",s.promptTpl=o?.promptTpl||"story-chat-session-tpl";let r=await t.create({component:ModalChatStoryComponent,componentProps:s,breakpoints:[.3,.5,.75,1],initialBreakpoint:i});r.present();let{data:a,role:l}=await r.onWillDismiss();return"confirm"==l?a:null}
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3N0b3J5L21vZGFsLWNoYXQtc3RvcnkvbW9kYWwtY2hhdC1zdG9yeS5jb21wb25lbnQubWpz`
|
|
10
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
|
+
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
|
+
* 保留所有权利 All Rights Reserved.
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/story/story.service.mjs
|
|
7
|
+
*/
|
|
8
|
+
import{Injectable}from"@angular/core";import{AgentStory}from"../../core";import*as i0 from"@angular/core";export class StoryService{constructor(){this.storyList=[]}newStory(t){let r;if(console.log("newStory"),this.storyList?.[0]&&!this.storyList?.[0]?.story?.id)return r=this.storyList?.[0],void console.log("新故事已创建");let o=new AgentStory(void 0,t?.person,t?.book);return console.log("new:",o),o&&(this.storyList?.unshift(o),r=o),o}static{this.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:StoryService,deps:[],target:i0.ɵɵFactoryTarget.Injectable})}static{this.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:StoryService,providedIn:"root"})}}i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:StoryService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:()=>[]});
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3N0b3J5L3N0b3J5LnNlcnZpY2UubWpz`
|
|
10
|
+
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* 保留所有权利 All Rights Reserved.
|
|
6
6
|
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/voice/fmode-voice.service.mjs
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import Recorder from"recorder-core";function checkWorkletSupport(){try{return window.AudioWorkletNode&&window.AudioContext&&window.AudioContext.audioWorklet&&!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch(t){return!1}}Recorder.ConnectEnableWorklet=checkWorkletSupport();import"recorder-core/src/engine/pcm";import"recorder-core/src/engine/wav";import"recorder-core/src/extensions/waveview";import CryptoJS from"crypto-js";import{pcmtoWav}from"./lib/pcm2wav";import{convertFrameBufferToBase64,resampleBuffer}from"./lib/resample";import{WebSpeech}from"./class-asr";export class FmodeVoiceService{constructor(t,e){this.platform=t,this.diagnostic=e,this.webSpeech=WebSpeech,this.isUserFinish=!1,this.recordWavBlob=null,this.recordPcmBlob=null,this.recordDuration=0,this.recordType="pcm",this.encodingType="raw",this.connStatus="",this.btnStatus="UNDEFINED",this.resultText="",this.resultTextTemp="",this.APPID="50f4a46c",this.API_SECRET="NzFlNmFhZDJjMDNkZGM3NzI0Mzg2OGNm",this.API_KEY="106ddc40dfd4b9ca6d7b47c70fada749",this.durationStr="00:00",this.duration=0,this.requestPermission()}toggleRecord(){console.log(this.btnStatus),"UNDEFINED"===this.btnStatus||"CLOSED"===this.btnStatus?this.startTalk():"CONNECTING"!==this.btnStatus&&"OPEN"!==this.btnStatus||this.finishTalk()}finishTalk(){this.isUserFinish=!0,this.onBeforeFinishTalk&&this.onBeforeFinishTalk(),this.recordStop()}async startTalk(t){this.resultText="",this.resultTextTemp="",this.onBeforeStartTalk&&this.onBeforeStartTalk(),event?.preventDefault(),await this.openWithPriviledge(),setTimeout((()=>{this.connectWebSocket()}),100),this.startCountdown(),this.onAfterStartTalk&&this.onAfterStartTalk()}cancelTalk(){this.onBeforeCancelTalk&&this.onBeforeCancelTalk(),this.recordStop(),this.iatWS?.close(),this.resultText=null,this.onAfterCancelTalk&&this.onAfterCancelTalk()}async recordStart(){this.createRecorder(),await this.openWithPriviledge(),this.recorder.start(),this.changeBtnStatus("OPEN"),this.onAfterRecordStart&&this.onAfterRecordStart()}recordStop(){return new Promise((t=>{clearInterval(this.countdownInterval),this.changeBtnStatus("CLOSED"),this.recorder?.stop((async(e,i)=>{try{this.iatWS.send(JSON.stringify({data:{status:2,format:"audio/L16;rate=16000",encoding:this.encodingType,audio:""}}))}catch(t){}let r=(window.URL||webkitURL).createObjectURL(e);console.log(e,r,"时长:"+i+"ms"),this.recordPcmBlob=e,this.recordWavBlob=await this.pcmBlobToWavBlob(e,44100),setTimeout((()=>{this.isUserFinish&&(this.onAfterFinishTalk&&this.onAfterFinishTalk(),this.isUserFinish=!1)}),2e3),this.recorder?.close(),this.recorder=null,t(!0)}),(e=>{console.log("录音失败:"+e),this.recorder.close(),this.recorder=null,t(null)}))}))}playRecord(){this.playPCM(this.recordPcmBlob,44100)}async pcmBlobToWavBlob(t,e){return new Promise((i=>{let r=new FileReader;r.onload=function(t){let r=t.target.result,s=pcmtoWav(r,e,1,16);i(s)},r.readAsArrayBuffer(t)}))}async playPCM(t,e){let i=await this.pcmBlobToWavBlob(t,e),r=window.URL.createObjectURL(i),s=new Audio;s.src=r,s.play()}async playBuffers(){let t=await this.BuffersToBlob(this.buffers);this.playPCM(t,44100)}BuffersToBlob(t){let e=[];return t.forEach((t=>{t.forEach((t=>{e.push(t)}))})),new Blob([e],{type:"audio/pcm"})}splitAudioData(t){const e=1280,i=Math.ceil(t.length/e),r=[];for(let s=0;s<i;s++){const i=s*e,o=i+e,a=t.slice(i,o);r.push(a)}return r}BufferToBlob(t){return new Blob([t],{type:"audio/pcm"})}createRecorder(){this.recorder||(this.recorder=Recorder({type:this.recordType,sampleRate:44100,bitRate:16,onProcess:(t,e,i,r,s,o)=>{let a=t.length&&t[t.length-1];if(this.buffers=t,a=resampleBuffer(a,44100,16e3),this.iatWS.readyState===this.iatWS.OPEN){if(this.disableASR)return;this.iatWS.send(JSON.stringify({data:{status:1,format:"audio/L16;rate=16000",encoding:this.encodingType,audio:convertFrameBufferToBase64(a)}}))}this.waveClient?.input(t[t.length-1],e,r)}}))}async openWithPriviledge(){return await this.requestPermission(),this.createRecorder(),!!Recorder.IsOpen()||new Promise((t=>{this.recorder.open((()=>{document.querySelector(".record-wave")&&Recorder.WaveView&&(this.waveClient=Recorder.WaveView({elem:".record-wave"})),t(!0)}),((t,e)=>{console.log((e?"UserNotAllow,":"")+"无法录音:"+t)}))}))}getWebSocketUrl(){let t="wss://iat-api.xfyun.cn/v2/iat",e="iat-api.xfyun.cn",i=this.API_KEY,r=this.API_SECRET,s=(new Date).toUTCString(),o=`host: ${e}\ndate: ${s}\nGET /v2/iat HTTP/1.1`,a=CryptoJS.HmacSHA256(o,r),n=CryptoJS.enc.Base64.stringify(a);return t=`${t}?authorization=${btoa(`api_key="${i}", algorithm="hmac-sha256", headers="host date request-line", signature="${n}"`)}&date=${s}&host=${e}`,t}toBase64(t){for(var e="",i=new Uint8Array(t),r=i.byteLength,s=0;s<r;s++)e+=String.fromCharCode(i[s]);return window.btoa(e)}countTimer(){this.duration++;let t=String(parseInt(String(this.duration/60))).padStart(2,"0")+":"+String((this.duration%60).toFixed(0)).padStart(2,"0");this.durationStr=t,this.connStatus=`录音中(${this.durationStr})`,this.onDurationStrChange&&this.onDurationStrChange(t)}startCountdown(){this.recordDuration=0,this.durationInterval&&clearInterval(this.durationInterval),this.countdownInterval=setInterval((()=>{this.recordDuration+=100}),100),this.now=new Date,this.duration=0,this.countdownInterval&&clearInterval(this.countdownInterval),this.countdownInterval=setInterval((()=>{this.countTimer()}),1e3)}changeBtnStatus(t){this.btnStatus=t,"CONNECTING"===t?this.connStatus="建立连接中":"OPEN"===t||("CLOSING"===t?this.connStatus="关闭连接中":"CLOSED"===t&&(this.connStatus="开始录音"))}renderResult(t){let e=JSON.parse(t);if(e.data&&e.data.result){let t=e.data.result,i="",r=t.ws;for(let t=0;t<r.length;t++)i+=r[t].cw[0].w;t.pgs?("apd"===t.pgs&&(this.resultText=this.resultTextTemp),this.resultTextTemp=this.resultText+i):this.resultText=this.resultText+i,this.resultTextTemp||this.resultText,this.onInputChange&&this.onInputChange(this.getUserInput())}0===e.code&&2===e.data.status&&this.iatWS.close(),0!==e.code&&(this.iatWS.close(),console.error(e))}getUserInput(){return""+(this.resultTextTemp||this.resultText)}connectWebSocket(){console.log("connectWebSocket");const t=this.getWebSocketUrl();if("WebSocket"in window)this.iatWS=new WebSocket(t);else if(!("MozWebSocket"in window))return void alert("浏览器不支持WebSocket");this.changeBtnStatus("CONNECTING"),this.iatWS.onopen=t=>{this.recordStart();var e={common:{app_id:this.APPID},business:{language:"zh_cn",domain:"iat",accent:"mandarin",vad_eos:5e3,dwa:"wpgs"},data:{status:0,format:"audio/L16;rate=16000",encoding:this.encodingType}};this.iatWS.send(JSON.stringify(e))},this.iatWS.onmessage=t=>{this.renderResult(t.data)},this.iatWS.onerror=t=>{console.error("error",t),this.recordStop(),this.changeBtnStatus("CLOSED")},this.iatWS.onclose=async t=>{this.reconnectWebsocket()}}async reconnectWebsocket(){this.isUserFinish||this.connectWebSocket()}isCapacitor(){return this.platform.is("capacitor")||this.platform.is("cordova")}async requestPermission(){if(this.isCapacitor())try{await this.requestStoagePermission(),await this.requestCameraPermission(),await this.requestMicPermission(),await this.requestRecordAudioPermission()}catch(t){console.error(t)}}async requestRecordAudioPermission(){let t=await this.diagnostic.requestRuntimePermissions([this.diagnostic.permission.RECORD_AUDIO]);console.log("record permission request:",t)}async requestMicPermission(){let t=await this.diagnostic.isMicrophoneAuthorized();if(console.log("permisson_MIC:",t),!t){await this.diagnostic.requestMicrophoneAuthorization()}}async requestStoagePermission(){let t=await this.diagnostic.isExternalStorageAuthorized();if(console.log("permisson_STORAGE:",t),!t){await this.diagnostic.requestExternalStorageAuthorization()}}async requestCameraPermission(){let t=await this.diagnostic.isCameraAuthorized();if(console.log("permisson_Camera:",t),!t){await this.diagnostic.requestCameraAuthorization()}}}
|
|
9
9
|
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3ZvaWNlL2Ztb2RlLXZvaWNlLnNlcnZpY2UubWpz`
|
|
10
10
|
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* 保留所有权利 All Rights Reserved.
|
|
6
6
|
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/voice/index.mjs
|
|
7
7
|
*/
|
|
8
|
-
export*from"./fmode-voice.service";export*from"./audio.player";export*from"./
|
|
8
|
+
export*from"./fmode-voice.service";export*from"./lib/audio/audio.player";export*from"./lib/audio/streamer.microsoft";export*from"./class-asr";export*from"./tts";export*from"./lib/audio/streamer.microsoft";
|
|
9
9
|
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3ZvaWNlL2luZGV4Lm1qcw==`
|
|
10
10
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
4
|
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
5
|
* 保留所有权利 All Rights Reserved.
|
|
6
|
-
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/voice/audio.player.mjs
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/voice/lib/audio/audio.player.mjs
|
|
7
7
|
*/
|
|
8
8
|
export class AudioPlayer{static{this.instance=null}constructor(){this.audio=new Audio}static getInstance(){return AudioPlayer.instance||(AudioPlayer.instance=new AudioPlayer),AudioPlayer.instance}setAudioEvent(t,i){this.audio[t]=i}get duration(){return this.audio.duration}get src(){return this.audio.src}stop(){this.audio.pause()}async play(t){return new Promise(((i,a)=>{this.audio.src!==t?(this.audio.src=t,this.audio.play().then((()=>{i()})).catch((()=>{a()}))):this.audio.paused?this.audio.play().then((()=>{i()})).catch((()=>{a()})):this.audio.pause()}))}}
|
|
9
|
-
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3ZvaWNlL2xpYi9hdWRpby9hdWRpby5wbGF5ZXIubWpz`
|
|
10
10
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
|
+
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
|
+
* 保留所有权利 All Rights Reserved.
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/voice/lib/audio/audio.streamer.mjs
|
|
7
|
+
*/
|
|
8
|
+
export{};
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3ZvaWNlL2xpYi9hdWRpby9hdWRpby5zdHJlYW1lci5tanM=`
|
|
10
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
|
+
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
|
+
* 保留所有权利 All Rights Reserved.
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/voice/lib/audio/streamer.microsoft.mjs
|
|
7
|
+
*/
|
|
8
|
+
import{Subject}from"rxjs";import{bufferWhen,filter,takeUntil}from"rxjs/operators";export class FmPushAudioOutputStreamCallback{constructor(){this.audioDataSubject=new Subject,this.playedSubject=new Subject,this.isPlaying=!1,this.isClosed=!1,this.audioBufferQueue=[],this.maxBufferSize=10,this.writeCount=0,this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.audioDataSubject.pipe(bufferWhen((()=>this.playedSubject)),takeUntil(this.audioDataSubject.pipe(filter((()=>this.isClosed))))).subscribe((t=>{this.playAudio(t)}))}async write(t){this.writeCount++,10==this.writeCount&&this.playedSubject.next(!0),this.audioDataSubject.next(t)}async playAudio(t){this.isPlaying=!0;const e=this.mergeArrayBuffers(t);let i;try{i=await this.audioContext.decodeAudioData(e)}catch(t){}if(i){const t=this.audioContext.createBufferSource();t.buffer=i,t.connect(this.audioContext.destination),t.start(),await new Promise((e=>{t.onended=e})),this.playedSubject.next(!0)}this.isPlaying=!1}mergeArrayBuffers(t){const e=t.reduce(((t,e)=>t+e.byteLength),0),i=new Uint8Array(e);let s=0;for(const e of t){const t=new Uint8Array(e);i.set(t,s),s+=t.length}return i.buffer}async stop(){this.isClosed=!0,this.audioDataSubject&&this.audioDataSubject.unsubscribe(),this.playedSubject&&this.playedSubject.unsubscribe(),this.audioContext&&this.audioContext.close()}async close(){console.log("close 数据加载完成"),this.isClosed=!0}}
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3ZvaWNlL2xpYi9hdWRpby9zdHJlYW1lci5taWNyb3NvZnQubWpz`
|
|
10
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
|
+
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
|
+
* 保留所有权利 All Rights Reserved.
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/voice/lib/audio/streamer.pcm.mjs
|
|
7
|
+
*/
|
|
8
|
+
export class PCMStreamer{constructor(t=24e3,e=1,i=16){this.bufferQueue=[],this.isPlaying=!1,this.currentSource=null,this.nextPlayTime=0,this.bufferedDuration=0,this.minBufferDuration=.5,this.targetBufferDuration=1,this.maxBufferDuration=1.5,this.mergeThreshold=.05,this.sampleRate=t,this.numChannels=e,this.bitsPerSample=i;const s=window.AudioContext||window.webkitAudioContext;this.audioContext=new s,document.addEventListener("click",(()=>{"suspended"===this.audioContext.state&&this.audioContext.resume()}),{once:!0})}write(t){if(0===t.byteLength)return;const e=this.calculateDuration(t);this.bufferedDuration+=e,this.bufferQueue.push(t),!this.isPlaying&&this.bufferedDuration>=this.minBufferDuration&&this.startPlayback()}startPlayback(){this.isPlaying||(this.isPlaying=!0,this.nextPlayTime=this.audioContext.currentTime,this.processBuffer())}processBuffer(){if("running"!==this.audioContext.state)return void this.audioContext.resume().then((()=>{setTimeout((()=>this.processBuffer()),50)}));if(this.bufferedDuration<this.minBufferDuration)return void(this.isPlaying=!1);const{mergedBuffer:t,totalDuration:e}=this.mergeBuffers();this.bufferedDuration-=e;const i=t.byteLength/(this.bitsPerSample/8)/this.numChannels,s=this.audioContext.createBuffer(this.numChannels,i,this.sampleRate);this.fillAudioBuffer(s,t);const r=this.audioContext.createBufferSource();r.buffer=s,r.connect(this.audioContext.destination);const n=this.audioContext.currentTime;this.nextPlayTime=Math.max(this.nextPlayTime,n),r.start(this.nextPlayTime),this.nextPlayTime+=s.duration,r.onended=()=>{this.currentSource=null,setTimeout((()=>this.processBuffer()),5)},this.currentSource=r}mergeBuffers(){let t=0,e=0;const i=[];for(;this.bufferQueue.length>0;){const s=this.bufferQueue[0],r=this.calculateDuration(s);if(e>0&&e+r>this.maxBufferDuration)break;if(i.push(this.bufferQueue.shift()),t+=s.byteLength,e+=r,e>=this.targetBufferDuration){if(this.bufferQueue.length>0&&this.calculateDuration(this.bufferQueue[0])<this.mergeThreshold)continue;break}}const s=new Uint8Array(t);let r=0;for(const t of i)s.set(new Uint8Array(t),r),r+=t.byteLength;return{mergedBuffer:s.buffer,totalDuration:e}}calculateDuration(t){const e=this.bitsPerSample/8;return t.byteLength/e/this.numChannels/this.sampleRate}fillAudioBuffer(t,e){const i=this.bitsPerSample/8,s=new DataView(e);for(let e=0;e<this.numChannels;e++){const r=t.getChannelData(e);let n=e*i;for(let t=0;t<r.length;t++){let e;if(16===this.bitsPerSample)e=s.getInt16(n,!0)/32768;else if(8===this.bitsPerSample)e=(s.getUint8(n)-128)/128;else{if(32!==this.bitsPerSample)throw new Error(`Unsupported bit depth: ${this.bitsPerSample}`);e=s.getInt32(n,!0)/2147483648}r[t]=e,n+=i*this.numChannels}}}stop(){this.currentSource&&(this.currentSource.stop(),this.currentSource=null),this.bufferQueue=[],this.isPlaying=!1,this.bufferedDuration=0,this.nextPlayTime=0}}
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3ZvaWNlL2xpYi9hdWRpby9zdHJlYW1lci5wY20ubWpz`
|
|
10
|
+
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* 保留所有权利 All Rights Reserved.
|
|
6
6
|
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/voice/tts/fmode-tts-class.mjs
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import Parse from"parse";import{AudioPlayer}from"../lib/audio/audio.player";import{FmPushAudioOutputStreamCallback}from"../lib/audio/streamer.microsoft";import{FmodeTTSProviderMicrosoft}from"./provider-microsoft";import{PCMStreamer}from"../lib/audio/streamer.pcm";export class FmodeTTS{static{this.activeInstance=null}stop(){FmodeTTS.activeInstance===this&&(FmodeTTS.activeInstance=null),this.audioPlayer?.stop(),this.audioStream?.stop(),this.provider?.stop(),this.isPlaying=!1}constructor(t,e){if(this.isPlaying=!1,this.uploadServ=e,this.config=t,this.audioPlayer=AudioPlayer.getInstance(),this.audioStream=new FmPushAudioOutputStreamCallback,this.provider=t.provider||new FmodeTTSProviderMicrosoft,console.log("初始化provider",t,this.provider,this.provider.constructor),this.provider.constructor.toString().indexOf("Doubao")>-1){const e=new PCMStreamer(24e3,1,16);t.audioStream=e}else t.audioStream=this.audioStream;this.audioStream=t?.audioStream||this.audioStream,this.provider.initialize(t),this.provider.eventMap=this.eventMap}extractTextFromXML(t){if(!t||"string"!=typeof t)return"";const e=/>([^<]+)</g,o=[];let i;for(;null!==(i=e.exec(t));){const t=i[1]?.trim();t&&o.push(t)}return o.join(" ")}extractSSMLContent(t){if(!t||"string"!=typeof t)return t||"";const e=t.match(/<speak.*?<\/speak>/s);return e?.[0]||t}async speakAsync(t,e,o){if(FmodeTTS.activeInstance&&FmodeTTS.activeInstance!==this&&FmodeTTS.activeInstance.stop(),FmodeTTS.activeInstance=this,!e){const o=Parse.Object.extend("ChatVoice");(e=new o).set("ssml",t),e.set("content",this.extractTextFromXML(t));const i=localStorage.getItem("company");i&&e.set("company",{__type:"Pointer",className:"Company",objectId:i}),Parse.User.current()?.id&&e.set("user",Parse.User.current().toPointer())}if(!e?.get("voiceFile")){const o=[];e?.get("content")&&o.push({content:e?.get("content")}),t&&o.push({ssml:t});const i=Parse.Query.fromJSON("ChatVoice",{include:"voiceFile",where:{$or:o}});i.exists("voiceFile"),i.addDescending("updatedAt");const s=await i.first();e.set("voiceFile",s?.get("voiceFile"))}return console.log("Exists playAudioData",e?.get("voiceFile")),e?.get("voiceFile")?(this.playAudioData(e?.get("voiceFile")?.get("url"),e,o),e.save(),e):(t=this.extractSSMLContent(t),this.isPlaying=!0,new Promise(((i,s)=>{const a=Date.now();this.provider.synthesize(t,(async t=>{const s=Date.now(),r=t?.audioData;let n=Number(t?.audioDuration);"microsoft"==this.config.provider&&(n/=1e4),e.set("duration",n),console.log("eventMap?.onResult",o,n),o?.onResult?.({duration:n});const c=new Blob([r],{type:"audio/wav"});await this.uploadAndSaveVoice(c,e),console.log(`Audio synthesis finished. Duration: ${s-a} ms`),setTimeout((()=>{this.isPlaying=!1,o?.onStop?.()}),2e3),i(e)}),(t=>{this.isPlaying=!1,s(`Error occurred during synthesis: ${t}`)}),(()=>{o?.onStart?.()}))})))}async playAudioData(t,e,o){let i;if(t?.indexOf?.("http")>=-1)i=t;else{const o=new Blob([t],{type:"audio/wav"});i=URL.createObjectURL(o),await this.uploadAndSaveVoice(o,e)}o?.onStart?.(e),this.isPlaying=!0;const s=this.audioPlayer;s.setAudioEvent("onloadeddata",(()=>{const t=1e3*s.duration;e?.get("duration")||(e.set("duration",t),e.save()),o?.onLoaded?.(s)})),["onabort","onerror","onpause","onended","onclose"].forEach((t=>{s.setAudioEvent(t,(()=>{this.isPlaying=!1,o?.onStop?.()}))}));const playAudio=()=>{s.play(i).catch((()=>{setTimeout(playAudio,200)}))};playAudio()}async uploadAndSaveVoice(t,e){if(!this.uploadServ)return null;const o=e?.id||this.uploadServ.genMd5(e?.get("content")||e?.get("ssml")),i=new Date,s=`${o}${i.getFullYear()}${i.getMonth()+1}${i.getDate()}${i.getHours()}${i.getMinutes()}${i.getSeconds()}.wav`,a=new File([t],s,{type:"audio/wav"}),r=await this.uploadServ.upload(a);return r?.id&&(e.set("voiceFile",{__type:"Pointer",className:"Attachment",objectId:r.id}),await e.save()),r?.url||null}}
|
|
9
9
|
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3ZvaWNlL3R0cy9mbW9kZS10dHMtY2xhc3MubWpz`
|
|
10
10
|
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* 保留所有权利 All Rights Reserved.
|
|
6
6
|
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/voice/tts/index.mjs
|
|
7
7
|
*/
|
|
8
|
-
export*from"./fmode-tts-class";
|
|
8
|
+
export*from"./fmode-tts-class";export*from"./provider-doubao";export*from"./provider-microsoft";export*from"../lib/audio/streamer.pcm";
|
|
9
9
|
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3ZvaWNlL3R0cy9pbmRleC5tanM=`
|
|
10
10
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
|
+
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
|
+
* 保留所有权利 All Rights Reserved.
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/voice/tts/int-tts-provider.mjs
|
|
7
|
+
*/
|
|
8
|
+
export{};
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3ZvaWNlL3R0cy9pbnQtdHRzLXByb3ZpZGVyLm1qcw==`
|
|
10
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
|
+
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
|
+
* 保留所有权利 All Rights Reserved.
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/voice/tts/provider-doubao.mjs
|
|
7
|
+
*/
|
|
8
|
+
import pako from"pako";import{v4 as uuidv4}from"uuid";export class FmodeTTSProviderDoubao{constructor(){this.ws=null,this.audioChunks=[],this.isSynthesizing=!1,this.isStarted=!1}initialize(e){if(!e.appId||!e.accessToken)throw new Error("appId, accessToken are required for Doubao TTS");e.cluster=e.cluster||"volcano_tts",this.config=e,this.audioStream=e.audioStream}synthesize(e,t,s,i){this.isSynthesizing&&this.stop(),this.isSynthesizing=!0,this.audioChunks=[],this.eventMap?.onSpeakBefore?.();const r=e?.indexOf("<speak")>-1,n=r?this.extractTextFromSSML(e):e;let o=uuidv4();const a=buildFullUrl("wss://openspeech.bytedance.com/api/v1/tts/ws_binary",{api_jwt:this.config.stsToken});this.ws=new WebSocket(a),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{this.eventMap?.onStreamStarted?.();const e={app:{appid:this.config.appId,token:this.config.accessToken,cluster:this.config.cluster},user:{uid:"user123"},audio:{voice_type:"zh_female_wenrouxiaoya_moon_bigtts",encoding:"pcm",rate:24e3,speed_ratio:1,volume_ratio:1,pitch_ratio:1,language:"cn"},request:{reqid:o,text:n,text_type:r?"ssml":"plain",operation:"submit"}},t=this.buildBinaryMessage(e);this.ws?.send(t)},this.ws.onmessage=async e=>{try{if(e.data instanceof ArrayBuffer){const r=new Uint8Array(e.data),n=this.parseResponse(r,i);if(n.error)return s(n.error),void this.stop();if(n.audio&&(this.audioChunks.push(n.audio),this.audioStream),n.isLast){this.eventMap?.onAudioCompleted?.();const{buffer:e,duration:s}=await this.mergePcmToWav(this.audioChunks);t({audioData:e,audioDuration:n.duration||s||0}),this.stop()}}else console.warn("Unexpected text message from TTS server:",e.data)}catch(e){s(`Error processing TTS response: ${e}`),this.stop()}},this.ws.onerror=e=>{s(`WebSocket error: ${JSON.stringify(e)}`),this.stop()},this.ws.onclose=()=>{this.isSynthesizing&&(s("WebSocket connection closed unexpectedly"),this.stop())}}buildBinaryMessage(e){const t=JSON.stringify(e),s=(new TextEncoder).encode(t),i=pako.gzip(s),r=new ArrayBuffer(8+i.length),n=new DataView(r);n.setUint8(0,17),n.setUint8(1,16),n.setUint8(2,17),n.setUint8(3,0),n.setUint32(4,i.length,!1);return new Uint8Array(r).set(i,8),r}parseResponse(e,t){const s=new DataView(e.buffer),i=(e[0],15&e[0]),r=e[1]>>4,n=15&e[1],o=(e[2],15&e[2]),a=(e[3],4*i);let u=e.slice(a);if(11==r){if(0===n)return{};{const e=s.getInt32(a,!1),i=(s.getInt32(a+4,!1),u.slice(8));return this.audioStream.write(i.buffer.slice(0)),this.isStarted||(t?.(),this.isStarted=!0),{audio:i.buffer,isLast:e<0}}}if(15===r){const e=s.getInt32(a,!1);s.getInt32(a+4,!1);let t=u.slice(8);return 1===o&&(t=pako.ungzip(t)),{error:`TTS error (code ${e}): ${(new TextDecoder).decode(t)}`}}if(12!==r)return{error:`Unknown message type: ${r}`};{s.getInt32(a,!1);let e=u.slice(4);1===o&&(e=pako.ungzip(e));try{return{duration:JSON.parse((new TextDecoder).decode(e)).duration||0}}catch(e){return console.warn("Failed to parse TTS metadata:",e),{}}}}stop(){this.isSynthesizing=!1,this.ws&&(this.ws.close(),this.ws=null),this.audioChunks=[]}dispose(){this.stop()}extractTextFromSSML(e){return e.replace(/<[^>]+>/g,"").trim()}async blobToArrayBuffer(e){return new Promise(((t,s)=>{const i=new FileReader;i.onload=()=>t(i.result),i.onerror=s,i.readAsArrayBuffer(e)}))}async mergePcmToWav(e){let t=0;e.forEach((e=>{t+=e.byteLength}));const s=1e3*t/48e3,i=new Uint8Array(t);let r=0;e.forEach((e=>{i.set(new Uint8Array(e),r),r+=e.byteLength}));const n=this.createWavHeader({sampleRate:24e3,numChannels:1,bitsPerSample:16,pcmDataSize:t}),o=new Uint8Array(n.byteLength+i.byteLength);return o.set(new Uint8Array(n),0),o.set(i,n.byteLength),{buffer:o.buffer,duration:s}}createWavHeader(e){const{sampleRate:t,numChannels:s,bitsPerSample:i,pcmDataSize:r}=e,n=t*s*i/8,o=s*i/8,a=new ArrayBuffer(44),u=new DataView(a);return this.writeString(u,0,"RIFF"),u.setUint32(4,36+r,!0),this.writeString(u,8,"WAVE"),this.writeString(u,12,"fmt "),u.setUint32(16,16,!0),u.setUint16(20,1,!0),u.setUint16(22,s,!0),u.setUint32(24,t,!0),u.setUint32(28,n,!0),u.setUint16(32,o,!0),u.setUint16(34,i,!0),this.writeString(u,36,"data"),u.setUint32(40,r,!0),a}writeString(e,t,s){for(let i=0;i<s.length;i++)e.setUint8(t+i,s.charCodeAt(i))}}export function buildFullUrl(e,t){const s=[];for(const e in t)s.push(`${e}=${encodeURIComponent(t[e])}`);return`${e}?${s.join("&")}`}
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3ZvaWNlL3R0cy9wcm92aWRlci1kb3ViYW8ubWpz`
|
|
10
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
|
+
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
|
+
* 保留所有权利 All Rights Reserved.
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/voice/tts/provider-microsoft.mjs
|
|
7
|
+
*/
|
|
8
|
+
import{SpeechSynthesizer}from"microsoft-cognitiveservices-speech-sdk";import{SpeechConfig}from"microsoft-cognitiveservices-speech-sdk";import{ResultReason}from"microsoft-cognitiveservices-speech-sdk";import{AudioConfig}from"microsoft-cognitiveservices-speech-sdk";console.log("SpeechConfig",SpeechConfig);import{AudioOutputConfigImpl}from"microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/AudioConfig";import{PushAudioOutputStreamImpl}from"microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/AudioOutputStream";export class FmodeTTSProviderMicrosoft{constructor(){}initialize(e){if(e.subscriptionKey)this.speechConfig=SpeechConfig.fromSubscription(e.subscriptionKey,e.region);else{if(!e.token)throw new Error("Either subscriptionKey or token must be provided");this.speechConfig=SpeechConfig.fromAuthorizationToken(e.token,e.region)}console.log("audio config",e,e.audioStream),this.audioConfig=new AudioOutputConfigImpl(new PushAudioOutputStreamImpl(e.audioStream)),this.synthesizer=new SpeechSynthesizer(this.speechConfig,this.audioConfig||AudioConfig.fromDefaultSpeakerOutput())}synthesize(e,i,o,s){if(!this.synthesizer)throw new Error("Synthesizer not initialized. Call initialize() first.");this.eventMap?.onSpeakBefore?.();const t=e?.indexOf("<")>-1?"speakSsmlAsync":"speakTextAsync";e=this.fixMarkdownChar(e),this.synthesizer[t](e,(e=>{e.reason===ResultReason.SynthesizingAudioStarted&&(s?.(),this.eventMap?.onStreamStarted?.()),e.reason===ResultReason.SynthesizingAudioCompleted?(this.eventMap?.onAudioCompleted?.(),i(e)):o(new Error(`Speech synthesis failed. Reason: ${e.errorDetails}`))}),(e=>{o(e)}))}stop(){this.synthesizer&&this.synthesizer.close()}dispose(){this.stop(),this.speechConfig=null,this.audioConfig=null,this.synthesizer=null}fixMarkdownChar(e){return e.replaceAll("*","")}}
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL3ZvaWNlL3R0cy9wcm92aWRlci1taWNyb3NvZnQubWpz`
|
|
10
|
+
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* 保留所有权利 All Rights Reserved.
|
|
6
6
|
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/core/agent/chat/completion/fmode-completion.mjs
|
|
7
7
|
*/
|
|
8
|
-
import{bufferTime,concatMap,delay,Observable}from"rxjs";const API_BASE="https://
|
|
8
|
+
import{bufferTime,concatMap,delay,Observable}from"rxjs";const API_BASE="https://test.fmode.cn/api/apig/aigc/gpt";import Parse from"parse";export class FmodeChatCompletion{constructor(e,t){this.content="",this.contentBuffer=[],this.isCompleted=!1,this.indexOfList=Number(e.length),this.messages=e,this.model=t?.model||"fmode-4.5-128k"}sendCompletion(e={messages:[]}){e.intTime=e?.intTime||50,e.isDirect=e?.isDirect||!1,e?.isDirect&&(e.intTime=1);let t={messages:this.messages,stream:!0,model:this.model,temperature:e?.temperature||.5,presence_penalty:e?.presence_penalty||0,frequency_penalty:e?.frequency_penalty||0};return e?.max_tokens&&(t.max_tokens=e?.max_tokens),new Observable((n=>{let s=RequestFmodeChatApi("/v1/chat/completions",t).subscribe((t=>{let o,r=String(t);try{o=chunkToJson(r)}catch(e){}if(("data: [DONE]"==r||o?.created&&o?.choices?.[0]?.finish_reason)&&(this.isCompleted=!0,e?.isDirect&&this.isCompleted&&(n.next({role:"assistant",content:this.content,complete:!0,createdAt:new Date}),s.unsubscribe(),e?.onComplete&&e.onComplete({role:"assistant",content:this.content,complete:!0,createdAt:new Date}),n.complete())),r.indexOf("data: {")>-1){let t=o?.choices?.[0]?.delta?.content||"";this.contentBuffer.push(t),e?.isDirect&&(this.content+=t||"",this.isCompleted||n.next({role:"assistant",cid:o?.id,content:this.content,createdAt:new Date})),e?.isDirect||this.contentPusher||(this.contentPusher=setInterval((()=>{this.isCompleted&&0==this.contentBuffer?.length&&(n.next({role:"assistant",cid:o?.id,content:this.content,complete:!0,createdAt:new Date}),s.unsubscribe(),clearInterval(this.contentPusher),n.complete()),this.contentBuffer?.length>=0&&(this.contentBuffer?.length>0&&(this.content+=this.contentBuffer.shift()),n.next({role:"assistant",cid:o?.id,content:this.content,createdAt:new Date}))}),e?.intTime))}}))})).pipe(bufferTime(100),concatMap((e=>e)),delay(200))}}function chunkToJson(e){let t;try{t=JSON.parse(e.replaceAll("data: ",""))}catch(e){}return t||{}}function RequestFmodeChatApi(e,t,n="POST"){return new Observable((s=>{let o=API_BASE+e,r=`Bearer ${Parse.User.current()?.getSessionToken()||localStorage.getItem("FMODE_AI_TOKEN")}`;return t.token=r,t&&(t=JSON.stringify(t)),fetch(o,{headers:{"Content-Type":"text/plain; charset=utf-8","Cache-Control":"no-cache"},body:t||null,method:n,credentials:"omit",mode:"cors"}).then((e=>{let t="";{let n=e.body?.getReader();const o=new TextDecoder;let r=new ReadableStream({start(e){!function read(){n.read().then((({done:t,value:n})=>{if(t)return e.close(),void s.complete();e.enqueue(n),read()}))}()}}).getReader();r.read().then((function processStream(e){let{done:n,value:a}=e;n||(!function processData(e){let n=(t+e).split("\n");if(n?.length>1){for(let e=0;e<n.length-1;e++){let t=n[e];s.next(t)}t=n[n.length-1]}}(o.decode(a)),r.read().then(processStream))}))}})).catch((e=>s.error(e))),()=>{}}))}function JsonToFormData(e){const t=new FormData;return function appendFormData(e,n=""){Array.isArray(e)?e.forEach(((e,t)=>{appendFormData(e,`${n}[${t}]`)})):"object"==typeof e&&null!==e?Object.keys(e).forEach((t=>{const s=n?`${n}.${t}`:t;appendFormData(e[t],s)})):t.append(n,e)}(e),t}
|
|
9
9
|
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9jb3JlL2FnZW50L2NoYXQvY29tcGxldGlvbi9mbW9kZS1jb21wbGV0aW9uLm1qcw==`
|
|
10
10
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
|
+
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
|
+
* 保留所有权利 All Rights Reserved.
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/core/agent/chat/completion/int-gpt-chat-options.mjs
|
|
7
|
+
*/
|
|
8
|
+
export{};
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9jb3JlL2FnZW50L2NoYXQvY29tcGxldGlvbi9pbnQtZ3B0LWNoYXQtb3B0aW9ucy5tanM=`
|
|
10
|
+
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* 保留所有权利 All Rights Reserved.
|
|
6
6
|
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/core/agent/chat/fmode-chat.mjs
|
|
7
7
|
*/
|
|
8
|
-
import{finalize}from"rxjs";import Parse from"parse";import{FmodeTTS}from"../../voice/tts";import{PromptTemplate}from"@langchain/core/prompts";import{getFormatTpl}from"../prompt/prompt-util";import{FmodeChatCompletion}from"./completion";const PromptTplTalkSSMLOutputCode="talk-ssml-output-tpl",PromptTplTalkTextSSMLCode="talk-text-ssml-tpl";export function getMessageContentText(t){let e="";return"string"==typeof t&&(e=t),"object"==typeof t&&(e=t?.find((t=>t?.text))?.text||""),e}export function getMessageImageUrl(t){return"object"==typeof t?t?.find((t=>t?.image_url))?.image_url?.url||"":null}export class FmodeChat{async loadModelList(t){if(this.modelList?.length)return;let e=new Parse.Query("ChatModel");e.notEqualTo("isDeleted",!0),e.equalTo("isEnabled",!0),e.addAscending("index"),this.modelList=await e.find(),this.currentModel=t||this.modelList?.find((t=>"fmode-4.5-128k"==t.get("code")))}showAvatar(){this.avatarConfig=this.role?.get("avatarConfig"),this.avatarConfig&&(this.isAvatarShow=!0,this.avatarConfig?.image&&(this.avatarConfig.image.waiting=this.avatarConfig.image.waiting||this.role?.get("thumb")||this.role?.get("avatar"),this.avatarMode="image"),this.avatarConfig?.video&&(this.avatarConfig.video.waiting=this.avatarConfig.video.waiting,this.avatarMode="video"))}scrollToBottom(t){t=t||this.scrollComp,t?.nativeElement?.scrollHeight&&(t.nativeElement.scrollTop=t.nativeElement.scrollHeight)}constructor(t,e,s,i,o,a,n){this.ChatSession=Parse.Object.extend("ChatSession"),this.messageList=[{role:"system",content:"系统提示:AI仅供参考"}],this.latestAIResponse="",this.userInput="",this.userImage="",this.isDirect=!1,this.mode="page",this.hideShare=!1,this.hideModalSelect=!1,this.hideInputPreview=!1,this.isAvatarShow=!1,this.avatarMode="",this.isPromptModalOpen=!1,this.isPromptMessageAreaShow=!0,this.promptList=[],this.focusUserInput=()=>{},this.leftButtons=[{title:"灵感",icon:"color-wand-outline",onClick:()=>{this.isPromptModalOpen=!0},show:()=>this?.promptList?.length},{title:"角色",icon:"people-outline",onClick:()=>{this.navCtrl?.navigateRoot("/chat/pro/mask")},show:()=>!0},{title:"呼叫",icon:"call-outline",onClick:()=>{this.chatServ?.callRole(this.role)},show:()=>this?.role?.get("voiceConfig")}],this.isVoiceInputMode=!1,this.isTexting=!1,this.isTalkMode=!1,this.SSMLRoleVoice="zh-CN-XiaoxiaoNeural",this.playAnimation=t=>{console.log(t)},this.welcome=async()=>{let t=this.messageList?.filter((t=>"assistant"==t?.role));if(t?.length)return;let e=Parse.User.current(),s=await this.loadSelf("Person","userVerify"),i=await this.loadSelf("Profile","user"),o=e?.get("nickname")||i?.get("name")||e?.get("realname")||e?.get("name"),a=s?.get("name")||s?.get("userVefiry")?.get("realname")||s?.get("userVefiry")?.get("nickname");s?.get("userVerify")?.id==e?.id&&(a="您");let n=this.role.get("voiceConfig")?.welcome?.prompt;if(this.role.get("voiceConfig")?.welcome?.promptList?.length){let t=this.role.get("voiceConfig")?.welcome?.promptList;n=t[Math.floor(Math.random()*t.length)]}if(!n)return;let r=await PromptTemplate.fromTemplate(n,{templateFormat:"mustache"}).format({name:o,userName:o,personName:a,timeOfDay:this.getTimeOfDay()}),l=await this.getVoiceByContentText(r),h={role:"assistant",voice:l,content:r,complete:!0};this.voiceMap[l?.id],this.playChatVoice(this.voiceMap[l?.id]),this.messageList.push(h)},this.self={},this.voiceMap={},this.VoiceTTSMap={},this.chatServ=i,this.role=e,this.sessionId=t,this.navCtrl=o,this.ncloud=a,this.uploadServ=n,s?.id&&(this.chatSession=s,this.messageList=this.chatSession.get("messageList"),this.sessionId=s?.id),this.role?.id&&(this.voiceConfig=this.role?.get("voiceConfig"),this.voiceConfig?.autoTalk&&(this.isTalkMode=!0,this.isDirect=!0))}getTimeOfDay(){const t=(new Date).getHours();return t>=5&&t<12?"早上":t>=12&&t<14?"中午":t>=14&&t<18?"下午":"晚上"}async loadSelf(t,e){if(this.self[t])return this.self[t];let s=Parse.User.current(),i=new Parse.Query(t);return i.include(e),i.equalTo(e,s?.id),this.self[t]=await i.first(),this.self[t]}async loadTalkSystemPrompt(t){if(!this.isTalkMode)return;if(!t)return;"男"==t?.get("gender")?this.SSMLRoleVoice="zh-CN-YunyeNeural":this.SSMLRoleVoice="zh-CN-XiaoxiaoNeural",this.SSMLRoleVoice=t?.get("voiceConfig")?.voice||this.SSMLRoleVoice;let e=await getFormatTpl("talk-ssml-output-tpl",{SSMLRoleVoice:this.SSMLRoleVoice}),s=t.get("prompt")||"请你扮演飞码AI的人工智能专家。";s+=e;let i={role:"user",content:s,hidden:!0},o=this.messageList?.map((t=>t?.content)).join();if(o.indexOf(s)>-1)return;let a=this.messageList?.findIndex((t=>"system"==t?.role)),n=a+1;this.messageList.splice(n,0,i)}loadRolePrompt(){let t=this.role?.get("prompt"),e={role:"user",content:t,hidden:!0};if(!t)return;let s=this.messageList?.map((t=>t?.content)).join();if(s.indexOf(t)>-1)return;let i=this.messageList?.findIndex((t=>"system"==t?.role)),o=i+1;this.messageList.splice(o,0,e)}async sendMessage(t="FmodeAiTest测试问题",e,s,i,o){if(this.scrollToBottom&&this.scrollToBottom(),this.isPromptMessageAreaShow=!1,this.loadRolePrompt(),e){let s={role:"user",content:[{type:"image_url",image_url:{url:e}},{type:"text",text:t}],complete:!0,createdAt:new Date};o&&(s.voice={id:o?.id}),this.messageList.push({role:"user",content:[{type:"image_url",image_url:{url:e}},{type:"text",text:t}],complete:!0,createdAt:new Date})}else{let e={role:"user",content:t,complete:!0,createdAt:new Date};o&&(e.voice={id:o?.id,duration:o?.duration}),this.messageList.push(e)}let a=new FmodeChatCompletion(this.fixMessageList(this.messageList),{model:this.currentModel?.get("code")||"fmode-4.5-128k"});if(this.onUserSend){if(!await this.onUserSend(this,this.messageList[this.messageList?.length-1]))return}this.userInput="",this.userImage="";let n=this.isDirect||!1;this.isTalkMode&&(n=!0);let r=a.sendCompletion({isDirect:n,onComplete:s||null}).pipe(finalize((async()=>{if(this.isTalkMode){let t=this.messageList[a.indexOfList]?.content,e=await this.getVoiceByContentText(t,i);i?.onSSMLComplete&&i?.onSSMLComplete(e),this.messageList[a.indexOfList].voice=e,this.playChatVoice(this.voiceMap[e?.id])}this.messageList[a.indexOfList].complete=!0}))).subscribe((t=>{this.messageList[a.indexOfList]=t,this.latestAIResponse=this.getContentText(t?.content);let e=this.chatSession?.get("messageList")?.length;this.messageList?.length>e&&this.saveChatSession(),t?.complete&&(this.onMessage&&this.onMessage(this,this.messageList[this.messageList?.length-1]),this.saveChatSession(),r.unsubscribe()),this.scrollToBottom&&this.scrollToBottom()}))}getVoiceByContentText(t,e,s=!1){let i=this.getContentText(t),o=new(Parse.Object.extend("ChatVoice")),a="";return this.SSMLRoleVoice=this.role?.get("voiceConfig")?.voice||this.SSMLRoleVoice,new Promise((async(t,e)=>{let resolveChatVoice=async()=>{o.set("content",i),o.set("ssml",a),o.set("role","assistant");let e=localStorage.getItem("company");e&&o.set("company",{__type:"Pointer",className:"Company",objectId:e}),Parse.User.current()?.id&&o.set("user",Parse.User.current().toPointer()),this.chatSession?.id&&o.set("session",this.chatSession?.toPointer()),o=await o.save(),this.voiceMap[o?.id]=o,t({id:o?.id})};if(0==s&&(a=`<speak xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="http://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" version="1.0" xml:lang="zh-CN"><voice name="${this.SSMLRoleVoice}">${i}</voice></speak>`,resolveChatVoice()),1==s){let t=await getFormatTpl("talk-text-ssml-tpl",{content:i,SSMLRoleVoice:this.SSMLRoleVoice});new FmodeChatCompletion(this.fixMessageList([{role:"user",content:t}]),{model:this.currentModel?.get("code")||"fmode-4.5-128k"}).sendCompletion({isDirect:!0}).subscribe((async t=>{t?.complete&&(a=this.getContentText(t?.content),resolveChatVoice())}))}}))}getContentText(t){return"string"==typeof t?t:t?.[0]?.text||""}async initTTS(){let t=await this.ncloud.apig("voice/tts/token",{company:localStorage.getItem("company")});if(t?.token){return new FmodeTTS(t,this.uploadServ)}return null}stopPlayingVoice(){Object.values(this.VoiceTTSMap).forEach((t=>{t?.isPlaying&&t?.stop()}))}async playChatVoice(t,e){let s=await this.initTTS();if(s){try{this.playAnimation("talking"),s.speakAsync(t?.get("ssml"),t,{onStart:t=>{e?.onStart&&e?.onStart(t)},onLoaded:t=>{e?.onLoaded&&e?.onLoaded(t)},onStop:()=>{e?.onStop&&e?.onStop(),this.playAnimation("waiting")}})}catch(t){}return this.VoiceTTSMap[t.id]=s,s}return null}async saveChatSession(){if("new"==this.sessionId&&(this.chatSession=new this.ChatSession),this.chatSession.set("title",this.genTitle()),this.chatSession.set("role",this.role?.toPointer()),this.chatSession.set("messageList",this.messageList),this.chatSession.set("user",Parse.User.current()?.toPointer()),this.chatSession=await this.chatSession.save(),this.onChatSaved&&this.onChatSaved(this),this.sessionId=this.chatSession?.id,this.sessionId){let t=`${window.location.origin}/chat/pro/chat/${this.sessionId}`;window.location?.pathname?.indexOf("chat/session")>-1&&(t=`${window.location.origin}/chat/session/chat/${this.sessionId}`),"modal"==this.mode&&(t=window.location.href),t=this.getInviteUrl(t),window.history.replaceState(null,null,t+window.location.search);let e={sid:this.chatSession?.id,rid:this.role?.id,name:this.role?.get("name"),message:this.chatSession?.get("messageList")?.[this.chatSession?.get("messageList")?.length-1]?.content?.slice(0,20),latest:this.chatSession?.createdAt};this.chatServ&&!this.chatServ?.chatList?.length&&(this.chatServ.chatList=[]);let s=this.chatServ?.chatList?.find((t=>t?.sid==e?.sid));s>-1?this.chatServ.chatList[s]=e:this.chatServ?.chatList.unshift(e)}}getInviteUrl(t){let e=new URL(t),s=Parse.User?.current()?.id;return e.searchParams.set("invite",s),e.href}genTitle(){if(this.title)return this.title;let t=this.messageList.find((t=>"user"==t.role))?.content;return"string"==typeof t&&(this.title=t?.slice(0,15)||""),"object"==typeof t&&(this.title=t?.find((t=>t?.text))?.text||""),this.title}fixMessageList(t){return t.map((t=>({role:t.role,content:t.content})))}nowStr(){let t=new Date;return`${t.getFullYear()}/${t.getMonth()+1}/${t.getDate()} ${t.getHours()}:${t.getMinutes()}:${t.getSeconds()}`}}
|
|
8
|
+
import{finalize}from"rxjs";import Parse from"parse";import{FmodeTTS,FmodeTTSProviderDoubao,FmodeTTSProviderMicrosoft}from"../../voice/tts";import{PromptTemplate}from"@langchain/core/prompts";import{getFormatTpl}from"../prompt/prompt-util";import{FmodeChatCompletion}from"./completion";const PromptTplTalkSSMLOutputCode="talk-ssml-output-tpl",PromptTplTalkTextSSMLCode="talk-text-ssml-tpl";export function getMessageContentText(t){let e="";return"string"==typeof t&&(e=t),"object"==typeof t&&(e=t?.find((t=>t?.text))?.text||""),e}export function getMessageImageUrl(t){return"object"==typeof t?t?.find((t=>t?.image_url))?.image_url?.url||"":null}export class FmodeChat{async loadModelList(t){if(this.modelList?.length)return;let e=new Parse.Query("ChatModel");e.notEqualTo("isDeleted",!0),e.equalTo("isEnabled",!0),e.addAscending("index"),this.modelList=await e.find(),this.currentModel=t||this.modelList?.find((t=>"fmode-4.5-128k"==t.get("code")))}showAvatar(){this.avatarConfig=this.role?.get("avatarConfig"),this.avatarConfig&&(this.isAvatarShow=!0,this.avatarConfig?.image&&(this.avatarConfig.image.waiting=this.avatarConfig.image.waiting||this.role?.get("thumb")||this.role?.get("avatar"),this.avatarMode="image"),this.avatarConfig?.video&&(this.avatarConfig.video.waiting=this.avatarConfig.video.waiting,this.avatarMode="video"))}scrollToBottom(t){t=t||this.scrollComp,t?.nativeElement?.scrollHeight&&(t.nativeElement.scrollTop=t.nativeElement.scrollHeight)}constructor(t,e,i,s,o,a,n){this.ChatSession=Parse.Object.extend("ChatSession"),this.messageList=[{role:"system",content:"系统提示:AI仅供参考"}],this.latestAIResponse="",this.userInput="",this.userImage="",this.isDirect=!1,this.mode="page",this.hideShare=!1,this.hideModalSelect=!1,this.hideInputPreview=!1,this.isAvatarShow=!1,this.avatarMode="",this.isPromptModalOpen=!1,this.isPromptMessageAreaShow=!0,this.promptList=[],this.focusUserInput=()=>{},this.leftButtons=[{title:"灵感",icon:"color-wand-outline",onClick:()=>{this.isPromptModalOpen=!0},show:()=>this?.promptList?.length},{title:"角色",icon:"people-outline",onClick:()=>{this.navCtrl?.navigateRoot("/chat/pro/mask")},show:()=>!0},{title:"呼叫",icon:"call-outline",onClick:()=>{this.chatServ?.callRole(this.role)},show:()=>this?.role?.get("voiceConfig")}],this.isVoiceInputMode=!1,this.isTexting=!1,this.isTalkMode=!1,this.SSMLRoleVoice="zh-CN-XiaoxiaoNeural",this.playAnimation=t=>{console.log(t)},this.welcome=async()=>{let t=this.messageList?.filter((t=>"assistant"==t?.role));if(t?.length)return;let e=Parse.User.current(),i=await this.loadSelf("Person","userVerify"),s=await this.loadSelf("Profile","user"),o=i?.get("name")||i?.get("userVefiry")?.get("realname")||i?.get("userVefiry")?.get("nickname"),a=e?.get("nickname")||s?.get("name")||e?.get("realname")||e?.get("name");i?.get("userVerify")?.id==e?.id&&(o="您"),a||(a=o);let n=this.role.get("voiceConfig")?.welcome?.prompt;if(this.role.get("voiceConfig")?.welcome?.promptList?.length){let t=this.role.get("voiceConfig")?.welcome?.promptList;n=t[Math.floor(Math.random()*t.length)]}if(!n)return;let r=await PromptTemplate.fromTemplate(n,{templateFormat:"mustache"}).format({name:a,userName:a,personName:o,timeOfDay:this.getTimeOfDay()}),l=await this.getVoiceByContentText(r),h={role:"assistant",voice:l,content:r,complete:!0};this.voiceMap[l?.id],this.playChatVoice(this.voiceMap[l?.id]),this.messageList.push(h)},this.self={},this.voiceMap={},this.VoiceTTSMap={},this.chatServ=s,this.role=e,this.sessionId=t,this.navCtrl=o,this.ncloud=a,this.uploadServ=n,i?.id&&(this.chatSession=i,this.messageList=this.chatSession.get("messageList"),this.sessionId=i?.id),this.role?.id&&(this.voiceConfig=this.role?.get("voiceConfig"),this.voiceConfig?.autoTalk&&(this.isTalkMode=this.isTalkMode||this.voiceConfig?.autoTalk,this.isDirect=!0))}getTimeOfDay(){const t=(new Date).getHours();return t>=5&&t<12?"早上":t>=12&&t<14?"中午":t>=14&&t<18?"下午":"晚上"}async loadSelf(t,e){if(this.self[t])return this.self[t];let i=Parse.User.current(),s=new Parse.Query(t);return s.include(e),s.equalTo(e,i?.id),this.self[t]=await s.first(),this.self[t]}async loadTalkSystemPrompt(t){if(!this.isTalkMode)return;if(!t)return;let e=t?.get("voiceConfig");"男"==t?.get("gender")?(this.SSMLRoleVoice="zh-CN-YunyeNeural","doubao"==e.provider&&(this.SSMLRoleVoice="zh_male_yangguangqingnian_emo_v2_mars_bigtts")):(this.SSMLRoleVoice="zh-CN-XiaoxiaoNeural","doubao"==e.provider&&(this.SSMLRoleVoice="zh_female_shuangkuaisisi_emo_v2_mars_bigtts")),this.SSMLRoleVoice=t?.get("voiceConfig")?.voice||this.SSMLRoleVoice;let i=await getFormatTpl("talk-ssml-output-tpl",{SSMLRoleVoice:this.SSMLRoleVoice}),s=t.get("prompt")||"请你扮演飞码AI的人工智能专家。";s+=i;let o={role:"user",content:s,hidden:!0},a=this.messageList?.map((t=>t?.content)).join();if(a.indexOf(s)>-1)return;let n=this.messageList?.findIndex((t=>"system"==t?.role)),r=n+1;this.messageList.splice(r,0,o)}loadRolePrompt(){let t=this.role?.get("prompt"),e={role:"user",content:t,hidden:!0};if(!t)return;let i=this.messageList?.map((t=>t?.content)).join();if(i.indexOf(t)>-1)return;let s=this.messageList?.findIndex((t=>"system"==t?.role)),o=s+1;this.messageList.splice(o,0,e)}async sendMessage(t="FmodeAiTest测试问题",e,i,s,o){if(this.scrollToBottom&&this.scrollToBottom(),this.isPromptMessageAreaShow=!1,this.loadRolePrompt(),e){let i={role:"user",content:[{type:"image_url",image_url:{url:e}},{type:"text",text:t}],complete:!0,createdAt:new Date};o&&(i.voice={id:o?.id}),this.messageList.push({role:"user",content:[{type:"image_url",image_url:{url:e}},{type:"text",text:t}],complete:!0,createdAt:new Date})}else{let e={role:"user",content:t,complete:!0,createdAt:new Date};o&&(e.voice={id:o?.id,duration:o?.duration}),this.messageList.push(e)}let a=new FmodeChatCompletion(this.fixMessageList(this.messageList),{model:this.currentModel?.get("code")||"fmode-4.5-128k"});if(this.onUserSend){if(!await this.onUserSend(this,this.messageList[this.messageList?.length-1]))return}this.userInput="",this.userImage="";let n=this.isDirect||!1;this.isTalkMode&&(n=!0);let r=a.sendCompletion({isDirect:n,onComplete:i||null}).pipe(finalize((async()=>{if(this.isTalkMode){let t=this.messageList[a.indexOfList]?.content,e=await this.getVoiceByContentText(t,s);s?.onSSMLComplete&&s?.onSSMLComplete(e),this.messageList[a.indexOfList].voice=e,this.playChatVoice(this.voiceMap[e?.id],{onResult:t=>{t?.duration&&(this.messageList[a.indexOfList].voice.duration=t?.duration)}})}this.messageList[a.indexOfList].complete=!0}))).subscribe((t=>{this.messageList[a.indexOfList]||s?.onMessageStart?.(t),this.messageList[a.indexOfList]=t,this.latestAIResponse=this.getContentText(t?.content);let e=this.chatSession?.get("messageList")?.length;this.messageList?.length>e&&this.saveChatSession(),t?.complete&&(this.onMessage&&this.onMessage(this,this.messageList[this.messageList?.length-1]),this.saveChatSession(),r.unsubscribe()),this.scrollToBottom&&this.scrollToBottom()}))}getVoiceByContentText(t,e,i=!1){let s=this.getContentText(t),o=new(Parse.Object.extend("ChatVoice")),a="",n=this.voiceConfig||this.role?.get("voiceConfig");return this.SSMLRoleVoice=n?.voice||this.SSMLRoleVoice,new Promise((async(t,e)=>{let resolveChatVoice=async()=>{o.set("content",s),o.set("ssml",a),o.set("role","assistant");let e=localStorage.getItem("company");e&&o.set("company",{__type:"Pointer",className:"Company",objectId:e}),Parse.User.current()?.id&&o.set("user",Parse.User.current().toPointer()),this.chatSession?.id&&o.set("session",this.chatSession?.toPointer()),o=await o.save(),this.voiceMap[o?.id]=o,t({id:o?.id})};if(0==i){let t=n?.provider||"microsoft",e=n?.rate,i=e?"</prosody>":"";a=`<speak provider="${t}">${e?`<prosody rate="${e}">`:""}<voice name="${this.SSMLRoleVoice}">${s}</voice>${i}</speak>`,resolveChatVoice()}if(1==i){let t=await getFormatTpl("talk-text-ssml-tpl",{content:s,SSMLRoleVoice:this.SSMLRoleVoice});new FmodeChatCompletion(this.fixMessageList([{role:"user",content:t}]),{model:this.currentModel?.get("code")||"fmode-4.5-128k"}).sendCompletion({isDirect:!0}).subscribe((async t=>{t?.complete&&(a=this.getContentText(t?.content),resolveChatVoice())}))}}))}getContentText(t){return"string"==typeof t?t:t?.[0]?.text||""}async initTTS(){this.voiceConfig=this.voiceConfig||this.role?.get("voiceConfig");let t=await this.ncloud.apig("voice/tts/token",{company:localStorage.getItem("company"),provider:this.voiceConfig?.provider||"microsoft"});if(t.provider=this.voiceConfig?.provider,t?.provider&&"microsoft"!=t?.provider||(t.provider=new FmodeTTSProviderMicrosoft),"doubao"==t?.provider&&(t.provider=new FmodeTTSProviderDoubao),console.log("initTTS",t),t?.token||t?.stsToken){return new FmodeTTS(t,this.uploadServ)}return null}stopPlayingVoice(){Object.values(this.VoiceTTSMap).forEach((t=>{t?.isPlaying&&t?.stop()}))}async playChatVoice(t,e){let i=await this.initTTS();if(console.log("playChatVoice",i),i){try{this.playAnimation("talking"),i.speakAsync(t?.get("ssml"),t,{onStart:t=>{e?.onStart&&e?.onStart(t)},onLoaded:t=>{e?.onLoaded&&e?.onLoaded(t)},onResult:t=>{e?.onResult&&e?.onResult(t)},onStop:()=>{e?.onStop&&e?.onStop(),this.playAnimation("waiting")}})}catch(t){}return this.VoiceTTSMap[t.id]=i,i}return null}async saveChatSession(){if("new"==this.sessionId&&(this.chatSession=new this.ChatSession),this.chatSession.set("title",this.genTitle()),this.chatSession.set("role",this.role?.toPointer()),this.chatSession.set("messageList",this.messageList),this.chatSession.set("user",Parse.User.current()?.toPointer()),this.chatSession=await this.chatSession.save(),this.onChatSaved&&this.onChatSaved(this),this.sessionId=this.chatSession?.id,this.sessionId){let t=`${window.location.origin}/chat/pro/chat/${this.sessionId}`;window.location?.pathname?.indexOf("chat/session")>-1&&(t=`${window.location.origin}/chat/session/chat/${this.sessionId}`),"modal"==this.mode&&(t=window.location.href),t=this.getInviteUrl(t),window.history.replaceState(null,null,t+window.location.search);let e={sid:this.chatSession?.id,rid:this.role?.id,name:this.role?.get("name"),message:this.chatSession?.get("messageList")?.[this.chatSession?.get("messageList")?.length-1]?.content?.slice(0,20),latest:this.chatSession?.createdAt};this.chatServ&&!this.chatServ?.chatList?.length&&(this.chatServ.chatList=[]);let i=this.chatServ?.chatList?.find((t=>t?.sid==e?.sid));i>-1?this.chatServ.chatList[i]=e:this.chatServ?.chatList.unshift(e)}}getInviteUrl(t){let e=new URL(t),i=Parse.User?.current()?.id;return e.searchParams.set("invite",i),e.href}genTitle(){if(this.title)return this.title;let t=this.messageList.find((t=>"user"==t.role))?.content;return"string"==typeof t&&(this.title=t?.slice(0,15)||""),"object"==typeof t&&(this.title=t?.find((t=>t?.text))?.text||""),this.title}fixMessageList(t){return t.map((t=>({role:t.role,content:t.content})))}nowStr(){let t=new Date;return`${t.getFullYear()}/${t.getMonth()+1}/${t.getDate()} ${t.getHours()}:${t.getMinutes()}:${t.getSeconds()}`}}
|
|
9
9
|
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9jb3JlL2FnZW50L2NoYXQvZm1vZGUtY2hhdC5tanM=`
|
|
10
10
|
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* 保留所有权利 All Rights Reserved.
|
|
6
6
|
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/core/agent/chat/index.mjs
|
|
7
7
|
*/
|
|
8
|
-
export*from"./fmode-chat";export*from"./interface";export*from"./completion
|
|
8
|
+
export*from"./fmode-chat";export*from"./interface";export*from"./completion";
|
|
9
9
|
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9jb3JlL2FnZW50L2NoYXQvaW5kZXgubWpz`
|
|
10
10
|
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* 保留所有权利 All Rights Reserved.
|
|
6
6
|
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/core/agent/prompt/agent.prompt.mjs
|
|
7
7
|
*/
|
|
8
|
-
import{PromptTemplate}from"@langchain/core/prompts";import{FmodeChatCompletion}from"../chat";import Parse from"parse";import{finalize}from"rxjs";export class AgentPrompt{constructor(){}jsonCompletion(e,t){let
|
|
8
|
+
import{PromptTemplate}from"@langchain/core/prompts";import{FmodeChatCompletion}from"../chat";import Parse from"parse";import{finalize}from"rxjs";export class AgentPrompt{constructor(){}jsonCompletion(e,t,r){let o,n=new FmodeChatCompletion([{role:"user",content:e}]);n.model=t||"fmode-4.0-cn-256k";let l=Object.assign({},{isDirect:!0,onComplete:e=>{e.complete=!0}},r);return n.sendCompletion(l).pipe(finalize((()=>{let e;try{o.json=this.extractAndParseJson(e)}catch(e){}o.complete=!0})))}extractAndParseJson(e){let t=e.indexOf("{");if(-1===t)return{};let r=0,o=t;for(let n=t;n<e.length;n++)if("{"===e[n]?r++:"}"===e[n]&&r--,0===r){o=n;break}if(0!==r)return{};const n=e.slice(t,o+1);try{return JSON.parse(n)}catch(e){return console.error("Failed to parse JSON:",e),{}}}extractMarkdownToMultiArray(e){let t=e.split("\n"),r=[],o=r,n=[r];for(let e of t){if(!e.trim())continue;if(e.startsWith("#")){let t=e.replace(/^#+\s*/,"");o.push([t]);continue}let t=e.search(/\S/)/2,r=e.trim().replace(/^-+\s*/,"");for(;t<n.length-1;)n.pop();for(;t>n.length-1;){let e=[];n[n.length-1].push(e),n.push(e)}o=n[n.length-1],o.push(r)}return r}async getFormatTpl(e,t){let r=await this.getPromptTpl(e);return await r.format(t)}async getPromptTpl(e){let t=new Parse.Query("PromptTemplate");t.equalTo("code",e);let r=await t.first();return PromptTemplate.fromTemplate(r?.get("template"),{templateFormat:"mustache"})}getTokens(e){return e=e||"",2*e?.length}}
|
|
9
9
|
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9jb3JlL2FnZW50L3Byb21wdC9hZ2VudC5wcm9tcHQubWpz`
|
|
10
10
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
|
+
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
|
+
* 保留所有权利 All Rights Reserved.
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/core/index.mjs
|
|
7
|
+
*/
|
|
8
|
+
export*from"./agent";export*from"./voice";
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9jb3JlL2luZGV4Lm1qcw==`
|
|
10
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @copyright © 未来飞马 © 未来全栈 www.fmode.cn
|
|
4
|
+
* 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
|
|
5
|
+
* 保留所有权利 All Rights Reserved.
|
|
6
|
+
* /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/core/voice/index.mjs
|
|
7
|
+
*/
|
|
8
|
+
export*from"./tts";
|
|
9
|
+
var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9jb3JlL3ZvaWNlL2luZGV4Lm1qcw==`
|
|
10
|
+
|