@saooti/octopus-sdk 40.1.3 → 40.1.5
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/package.json +1 -2
- package/src/components/composable/player/usePlayerLogic.ts +3 -0
- package/src/components/composable/player/usePlayerVast.ts +11 -2
- package/src/components/composable/radio/usefetchRadioData.ts +5 -0
- package/src/components/form/ClassicInputText.vue +5 -0
- package/src/stores/VastStore.ts +5 -0
- package/src/stores/class/openai/openAiParams.ts +6 -19
- package/src/stores/class/transcript/transcriptParams.ts +47 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saooti/octopus-sdk",
|
|
3
|
-
"version": "40.1.
|
|
3
|
+
"version": "40.1.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Javascript SDK for using octopus",
|
|
6
6
|
"author": "Saooti",
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"proxy_non_authentifié": "node proxy.ts false",
|
|
13
13
|
"lint": "eslint --fix src",
|
|
14
14
|
"stylelint": "stylelint **/*.{scss,vue} --fix",
|
|
15
|
-
"build_bundle": "vue-cli-service build --target lib --name octopus ./index.js",
|
|
16
15
|
"sonar": "node sonarqube-scanner.js"
|
|
17
16
|
},
|
|
18
17
|
"dependencies": {
|
|
@@ -101,6 +101,9 @@ export const usePlayerLogic = (forceHide: Ref<boolean, boolean>)=>{
|
|
|
101
101
|
audioPlayer.pause();
|
|
102
102
|
} else if ("PLAYING" === playerStore.playerStatus && playerStore.playerRadio) {
|
|
103
103
|
if (playerStore.playerRadio.isInit) {
|
|
104
|
+
if(vastStore.isAdPlaying && !vastStore.resetSessionId){
|
|
105
|
+
playerStore.playerRadio.dateSessionId = dayjs().toISOString();
|
|
106
|
+
}
|
|
104
107
|
playRadio();
|
|
105
108
|
} else {
|
|
106
109
|
playerStore.playerRadio.isInit = true;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { usePlayerStore } from "../../../stores/PlayerStore";
|
|
2
2
|
import { useVastStore } from "../../../stores/VastStore";
|
|
3
3
|
import { loadScript } from "../../../helper/loadScript";
|
|
4
|
-
import {Ref, ref, watch} from 'vue';
|
|
4
|
+
import {nextTick, Ref, ref, watch} from 'vue';
|
|
5
|
+
import dayjs from "dayjs";
|
|
5
6
|
let adsLoader: any;
|
|
6
7
|
let adsManager:any;
|
|
7
8
|
let adDisplayContainer:any;
|
|
@@ -12,6 +13,7 @@ export const usePlayerVast = ()=>{
|
|
|
12
13
|
const audioContainer : Ref<HTMLAudioElement|null>= ref(null);
|
|
13
14
|
const isAdRequested = ref(false);
|
|
14
15
|
const statusPlayerWhenLoaded = ref("");
|
|
16
|
+
const dateForSessionId: Ref<string|undefined> = ref(undefined);
|
|
15
17
|
|
|
16
18
|
const playerStore = usePlayerStore();
|
|
17
19
|
const vastStore = useVastStore();
|
|
@@ -169,10 +171,13 @@ export const usePlayerVast = ()=>{
|
|
|
169
171
|
}
|
|
170
172
|
|
|
171
173
|
function onContentResumeRequested() {
|
|
172
|
-
vastStore.updateIsAdPlaying(false);
|
|
173
174
|
if (!isContentFinished.value) {
|
|
174
175
|
playerStore.playerChangeStatus(false);
|
|
175
176
|
}
|
|
177
|
+
nextTick(() => {
|
|
178
|
+
vastStore.updateIsAdPlaying(false);
|
|
179
|
+
vastStore.updateResetSessionId(false);
|
|
180
|
+
});
|
|
176
181
|
}
|
|
177
182
|
|
|
178
183
|
function contentEndedAdsLoader():void{
|
|
@@ -185,8 +190,12 @@ export const usePlayerVast = ()=>{
|
|
|
185
190
|
if(!adsManager){return;}
|
|
186
191
|
if(vastStore.isAdPaused){
|
|
187
192
|
adsManager.pause();
|
|
193
|
+
dateForSessionId.value = dayjs().toISOString();
|
|
188
194
|
}else{
|
|
189
195
|
adsManager.resume();
|
|
196
|
+
if(!vastStore.resetSessionId &&dayjs().diff(dayjs(dateForSessionId.value), 'm')>1){
|
|
197
|
+
vastStore.updateResetSessionId(true);
|
|
198
|
+
}
|
|
190
199
|
}
|
|
191
200
|
}
|
|
192
201
|
|
|
@@ -24,6 +24,11 @@ export const useFetchRadio = ()=>{
|
|
|
24
24
|
api: 14,
|
|
25
25
|
path: "player/playing/" + canalId,
|
|
26
26
|
});
|
|
27
|
+
/* metadata.nextAdvertising={
|
|
28
|
+
"adCount": 1,
|
|
29
|
+
"startDate": "2025-03-04T13:12:00Z",
|
|
30
|
+
"tag": "5e385e1b51c86"
|
|
31
|
+
}; */
|
|
27
32
|
if(callbackAdvertising){
|
|
28
33
|
callbackAdvertising(metadata.nextAdvertising);
|
|
29
34
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
:class="{ 'form-margin': displayLabel }"
|
|
5
5
|
>
|
|
6
6
|
<div class="d-flex align-items-center">
|
|
7
|
+
<slot name="complementLabel"/>
|
|
7
8
|
<component
|
|
8
9
|
:is="isWysiwyg? 'div': 'label'"
|
|
9
10
|
:class="[classLabel, displayLabel ? '' : 'd-none']"
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
</div>
|
|
34
35
|
<input
|
|
35
36
|
v-if="!isWysiwyg && !isTextarea"
|
|
37
|
+
v-show="showField"
|
|
36
38
|
:id="inputId"
|
|
37
39
|
ref="focusElement"
|
|
38
40
|
v-model="textValue"
|
|
@@ -52,6 +54,7 @@
|
|
|
52
54
|
/>
|
|
53
55
|
<textarea
|
|
54
56
|
v-else-if="isTextarea"
|
|
57
|
+
v-show="showField"
|
|
55
58
|
:id="inputId"
|
|
56
59
|
ref="focusElement"
|
|
57
60
|
v-model="textValue"
|
|
@@ -68,6 +71,7 @@
|
|
|
68
71
|
/>
|
|
69
72
|
<ClassicWysiwyg
|
|
70
73
|
v-else
|
|
74
|
+
v-show="showField"
|
|
71
75
|
v-model:content="textValue"
|
|
72
76
|
:error-description="
|
|
73
77
|
forceError || (isError && (undefined !== textValue || canBeNull))
|
|
@@ -153,6 +157,7 @@ export default defineComponent({
|
|
|
153
157
|
typeInput: { default: "text", type: String },
|
|
154
158
|
displayRequired: { default: false, type: Boolean },
|
|
155
159
|
classLabel: { default: "form-label", type: String },
|
|
160
|
+
showField: { default: true, type: Boolean },
|
|
156
161
|
},
|
|
157
162
|
emits: ["update:textInit", "update:errorVariable"],
|
|
158
163
|
data() {
|
package/src/stores/VastStore.ts
CHANGED
|
@@ -11,6 +11,7 @@ interface VastState {
|
|
|
11
11
|
timeTillSkipInSeconds: number;
|
|
12
12
|
currentTimeAd: number;
|
|
13
13
|
currentDurationAd: number;
|
|
14
|
+
resetSessionId: boolean;
|
|
14
15
|
|
|
15
16
|
useVastPlayerPodcast: boolean;
|
|
16
17
|
adPositionIndex: number;
|
|
@@ -28,6 +29,7 @@ function emptyVastState(): VastState {
|
|
|
28
29
|
timeTillSkipInSeconds: 0,
|
|
29
30
|
currentTimeAd: 0,
|
|
30
31
|
currentDurationAd: 0,
|
|
32
|
+
resetSessionId: false,
|
|
31
33
|
|
|
32
34
|
useVastPlayerPodcast: false,
|
|
33
35
|
adPositionIndex: 0,
|
|
@@ -68,6 +70,9 @@ export const useVastStore = defineStore("VastStore", {
|
|
|
68
70
|
updateAdPositionIndex(index: number) {
|
|
69
71
|
this.adPositionIndex = index;
|
|
70
72
|
},
|
|
73
|
+
updateResetSessionId(value: boolean) {
|
|
74
|
+
this.resetSessionId = value;
|
|
75
|
+
},
|
|
71
76
|
updateAdPositionsPodcasts(
|
|
72
77
|
podcastId: number,
|
|
73
78
|
adPositions: Array<AdPosition>,
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
export interface OpenAiParams {
|
|
2
|
-
frequencyPenalty: number | null; // -2 -> 2
|
|
3
|
-
presencePenalty: number | null; // -2 -> 2
|
|
4
|
-
temperature: number | null; // 0-> 2
|
|
5
|
-
promptKeyword: string | null;
|
|
6
|
-
promptKeywordAndSummary: string | null;
|
|
7
|
-
promptSummary: string | null;
|
|
8
2
|
promptLinkedin: string | null;
|
|
9
3
|
promptFacebook: string | null;
|
|
10
4
|
promptX: string | null;
|
|
11
5
|
preamble: string | null;
|
|
12
6
|
postamble: string | null;
|
|
7
|
+
summaryMaxWordNumbers: number|null;
|
|
8
|
+
maxChapters: number|null;
|
|
9
|
+
chapterMinSeconds: number|null;
|
|
13
10
|
}
|
|
14
11
|
export interface OpenAiHistory {
|
|
15
12
|
content: string;
|
|
@@ -18,23 +15,13 @@ export interface OpenAiHistory {
|
|
|
18
15
|
|
|
19
16
|
export function emptyOpenAiParams(): OpenAiParams {
|
|
20
17
|
return {
|
|
21
|
-
frequencyPenalty: null,
|
|
22
|
-
presencePenalty: null,
|
|
23
|
-
temperature: null,
|
|
24
18
|
postamble: null,
|
|
25
19
|
preamble: null,
|
|
26
20
|
promptFacebook: null,
|
|
27
|
-
promptKeyword: null,
|
|
28
|
-
promptKeywordAndSummary: null,
|
|
29
21
|
promptLinkedin: null,
|
|
30
|
-
promptSummary: null,
|
|
31
22
|
promptX: null,
|
|
23
|
+
summaryMaxWordNumbers: null,
|
|
24
|
+
maxChapters: null,
|
|
25
|
+
chapterMinSeconds: null
|
|
32
26
|
};
|
|
33
27
|
}
|
|
34
|
-
|
|
35
|
-
export function getLimitBottom(key: string): number {
|
|
36
|
-
if ("frequencyPenalty" === key || "presencePenalty" === key) {
|
|
37
|
-
return -2;
|
|
38
|
-
}
|
|
39
|
-
return 0;
|
|
40
|
-
}
|
|
@@ -1,23 +1,50 @@
|
|
|
1
1
|
export interface TranscriptParams {
|
|
2
|
-
automation: string;
|
|
2
|
+
automation: string; // super, {date}, false
|
|
3
|
+
ttsParams: TtsParams;
|
|
4
|
+
modifyPodcast: ModifyPodcastConfig
|
|
5
|
+
}
|
|
6
|
+
export interface TtsParams {
|
|
7
|
+
super: string;
|
|
8
|
+
style: string;
|
|
9
|
+
pitch: number;
|
|
10
|
+
speed: number;
|
|
11
|
+
voice: string;
|
|
12
|
+
language: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ModifyPodcastConfig {
|
|
16
|
+
modifyChaptering: ModifyPodcastEnum;
|
|
17
|
+
modifyKeywords: ModifyPodcastEnum;
|
|
18
|
+
modifyDescription: ModifyPodcastEnum;
|
|
19
|
+
createDescriptionUsingAi: boolean;
|
|
3
20
|
wordsNumber: number;
|
|
4
|
-
modifyDescription: string;
|
|
5
|
-
isWordsNumber: boolean;
|
|
6
|
-
openAiBehavior: string; //no, keywords, description, descriptionAndKeywords
|
|
7
|
-
ttsParams: { [key: string]: string | number | undefined };
|
|
8
21
|
}
|
|
9
22
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
23
|
+
export enum ModifyPodcastEnum {
|
|
24
|
+
SUPER = "SUPER",
|
|
25
|
+
NO = "NO",
|
|
26
|
+
IF_EMPTY = "IF_EMPTY",
|
|
27
|
+
OVERWRITE="OVERWRITE"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function defaultTtsParams(): TtsParams {
|
|
14
31
|
return {
|
|
15
|
-
|
|
32
|
+
super: "true",
|
|
33
|
+
style: "neutral",
|
|
34
|
+
pitch: 0,
|
|
35
|
+
speed: 1,
|
|
36
|
+
voice: "",
|
|
37
|
+
language: ""
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function defaultModifyPodcastConfig(): ModifyPodcastConfig {
|
|
42
|
+
return {
|
|
43
|
+
modifyChaptering: ModifyPodcastEnum.NO,
|
|
44
|
+
modifyKeywords:ModifyPodcastEnum.NO,
|
|
45
|
+
modifyDescription:ModifyPodcastEnum.NO,
|
|
46
|
+
createDescriptionUsingAi: false,
|
|
16
47
|
wordsNumber: 100,
|
|
17
|
-
modifyDescription: modifyDescription ?? "NO",
|
|
18
|
-
isWordsNumber: true,
|
|
19
|
-
openAiBehavior: "no",
|
|
20
|
-
ttsParams: {},
|
|
21
48
|
};
|
|
22
49
|
}
|
|
23
50
|
|
|
@@ -30,3 +57,9 @@ export interface Voice {
|
|
|
30
57
|
styles?: [];
|
|
31
58
|
provider: string;
|
|
32
59
|
}
|
|
60
|
+
export interface ProviderTts {
|
|
61
|
+
name: string;
|
|
62
|
+
fullName: string;
|
|
63
|
+
logoPath: string;
|
|
64
|
+
description: string;
|
|
65
|
+
}
|