yt-transcript-strapi-plugin 0.0.21 → 0.0.25
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/dist/server/index.js +477 -153
- package/dist/server/index.mjs +477 -153
- package/dist/server/src/config/index.d.ts +8 -8
- package/dist/server/src/content-types/index.d.ts +0 -3
- package/dist/server/src/content-types/transcript/index.d.ts +0 -3
- package/dist/server/src/index.d.ts +8 -12
- package/dist/server/src/mcp/schemas/index.d.ts +63 -6
- package/dist/server/src/mcp/tools/fetch-transcript.d.ts +0 -5
- package/dist/server/src/mcp/tools/get-transcript.d.ts +26 -0
- package/dist/server/src/mcp/tools/index.d.ts +13 -13
- package/dist/server/src/mcp/tools/search-transcript.d.ts +30 -0
- package/dist/server/src/services/index.d.ts +0 -1
- package/dist/server/src/services/service.d.ts +0 -2
- package/package.json +7 -6
- package/dist/server/src/utils/openai.d.ts +0 -9
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
default: {
|
|
3
|
-
openAIApiKey: string;
|
|
4
|
-
model: string;
|
|
5
|
-
temp: number;
|
|
6
|
-
maxTokens: number;
|
|
7
3
|
proxyUrl: string;
|
|
4
|
+
chunkSizeSeconds: number;
|
|
5
|
+
previewLength: number;
|
|
6
|
+
maxFullTranscriptLength: number;
|
|
7
|
+
searchSegmentSeconds: number;
|
|
8
8
|
};
|
|
9
9
|
validator(config: {
|
|
10
|
-
openAIApiKey?: string;
|
|
11
|
-
model?: string;
|
|
12
|
-
temp?: number;
|
|
13
|
-
maxTokens?: number;
|
|
14
10
|
proxyUrl?: string;
|
|
11
|
+
chunkSizeSeconds?: number;
|
|
12
|
+
previewLength?: number;
|
|
13
|
+
maxFullTranscriptLength?: number;
|
|
14
|
+
searchSegmentSeconds?: number;
|
|
15
15
|
}): void;
|
|
16
16
|
};
|
|
17
17
|
export default _default;
|
|
@@ -10,18 +10,18 @@ declare const _default: {
|
|
|
10
10
|
}) => void;
|
|
11
11
|
config: {
|
|
12
12
|
default: {
|
|
13
|
-
openAIApiKey: string;
|
|
14
|
-
model: string;
|
|
15
|
-
temp: number;
|
|
16
|
-
maxTokens: number;
|
|
17
13
|
proxyUrl: string;
|
|
14
|
+
chunkSizeSeconds: number;
|
|
15
|
+
previewLength: number;
|
|
16
|
+
maxFullTranscriptLength: number;
|
|
17
|
+
searchSegmentSeconds: number;
|
|
18
18
|
};
|
|
19
19
|
validator(config: {
|
|
20
|
-
openAIApiKey?: string;
|
|
21
|
-
model?: string;
|
|
22
|
-
temp?: number;
|
|
23
|
-
maxTokens?: number;
|
|
24
20
|
proxyUrl?: string;
|
|
21
|
+
chunkSizeSeconds?: number;
|
|
22
|
+
previewLength?: number;
|
|
23
|
+
maxFullTranscriptLength?: number;
|
|
24
|
+
searchSegmentSeconds?: number;
|
|
25
25
|
}): void;
|
|
26
26
|
};
|
|
27
27
|
controllers: {
|
|
@@ -94,7 +94,6 @@ declare const _default: {
|
|
|
94
94
|
}>;
|
|
95
95
|
saveTranscript(payload: Record<string, unknown>): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
96
96
|
findTranscript(videoId: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
97
|
-
generateHumanReadableTranscript(transcript: string): Promise<string>;
|
|
98
97
|
};
|
|
99
98
|
};
|
|
100
99
|
contentTypes: {
|
|
@@ -131,9 +130,6 @@ declare const _default: {
|
|
|
131
130
|
transcriptWithTimeCodes: {
|
|
132
131
|
type: string;
|
|
133
132
|
};
|
|
134
|
-
readableTranscript: {
|
|
135
|
-
type: string;
|
|
136
|
-
};
|
|
137
133
|
};
|
|
138
134
|
};
|
|
139
135
|
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const FetchTranscriptSchema: z.ZodObject<{
|
|
3
3
|
videoId: z.ZodString;
|
|
4
|
-
generateReadable: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
5
4
|
}, "strip", z.ZodTypeAny, {
|
|
6
5
|
videoId?: string;
|
|
7
|
-
generateReadable?: boolean;
|
|
8
6
|
}, {
|
|
9
7
|
videoId?: string;
|
|
10
|
-
generateReadable?: boolean;
|
|
11
8
|
}>;
|
|
12
9
|
export declare const ListTranscriptsSchema: z.ZodObject<{
|
|
13
10
|
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
@@ -24,10 +21,41 @@ export declare const ListTranscriptsSchema: z.ZodObject<{
|
|
|
24
21
|
}>;
|
|
25
22
|
export declare const GetTranscriptSchema: z.ZodObject<{
|
|
26
23
|
videoId: z.ZodString;
|
|
24
|
+
includeFullTranscript: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
25
|
+
includeTimecodes: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
26
|
+
startTime: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
endTime: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
chunkIndex: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
chunkSize: z.ZodOptional<z.ZodNumber>;
|
|
27
30
|
}, "strip", z.ZodTypeAny, {
|
|
28
31
|
videoId?: string;
|
|
32
|
+
includeFullTranscript?: boolean;
|
|
33
|
+
includeTimecodes?: boolean;
|
|
34
|
+
startTime?: number;
|
|
35
|
+
endTime?: number;
|
|
36
|
+
chunkIndex?: number;
|
|
37
|
+
chunkSize?: number;
|
|
29
38
|
}, {
|
|
30
39
|
videoId?: string;
|
|
40
|
+
includeFullTranscript?: boolean;
|
|
41
|
+
includeTimecodes?: boolean;
|
|
42
|
+
startTime?: number;
|
|
43
|
+
endTime?: number;
|
|
44
|
+
chunkIndex?: number;
|
|
45
|
+
chunkSize?: number;
|
|
46
|
+
}>;
|
|
47
|
+
export declare const SearchTranscriptSchema: z.ZodObject<{
|
|
48
|
+
videoId: z.ZodString;
|
|
49
|
+
query: z.ZodString;
|
|
50
|
+
maxResults: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
videoId?: string;
|
|
53
|
+
query?: string;
|
|
54
|
+
maxResults?: number;
|
|
55
|
+
}, {
|
|
56
|
+
videoId?: string;
|
|
57
|
+
query?: string;
|
|
58
|
+
maxResults?: number;
|
|
31
59
|
}>;
|
|
32
60
|
export declare const FindTranscriptsSchema: z.ZodObject<{
|
|
33
61
|
query: z.ZodOptional<z.ZodString>;
|
|
@@ -57,17 +85,15 @@ export declare const FindTranscriptsSchema: z.ZodObject<{
|
|
|
57
85
|
export type FetchTranscriptInput = z.infer<typeof FetchTranscriptSchema>;
|
|
58
86
|
export type ListTranscriptsInput = z.infer<typeof ListTranscriptsSchema>;
|
|
59
87
|
export type GetTranscriptInput = z.infer<typeof GetTranscriptSchema>;
|
|
88
|
+
export type SearchTranscriptInput = z.infer<typeof SearchTranscriptSchema>;
|
|
60
89
|
export type FindTranscriptsInput = z.infer<typeof FindTranscriptsSchema>;
|
|
61
90
|
export declare const ToolSchemas: {
|
|
62
91
|
readonly fetch_transcript: z.ZodObject<{
|
|
63
92
|
videoId: z.ZodString;
|
|
64
|
-
generateReadable: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
65
93
|
}, "strip", z.ZodTypeAny, {
|
|
66
94
|
videoId?: string;
|
|
67
|
-
generateReadable?: boolean;
|
|
68
95
|
}, {
|
|
69
96
|
videoId?: string;
|
|
70
|
-
generateReadable?: boolean;
|
|
71
97
|
}>;
|
|
72
98
|
readonly list_transcripts: z.ZodObject<{
|
|
73
99
|
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
@@ -84,10 +110,41 @@ export declare const ToolSchemas: {
|
|
|
84
110
|
}>;
|
|
85
111
|
readonly get_transcript: z.ZodObject<{
|
|
86
112
|
videoId: z.ZodString;
|
|
113
|
+
includeFullTranscript: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
114
|
+
includeTimecodes: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
115
|
+
startTime: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
endTime: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
chunkIndex: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
chunkSize: z.ZodOptional<z.ZodNumber>;
|
|
87
119
|
}, "strip", z.ZodTypeAny, {
|
|
88
120
|
videoId?: string;
|
|
121
|
+
includeFullTranscript?: boolean;
|
|
122
|
+
includeTimecodes?: boolean;
|
|
123
|
+
startTime?: number;
|
|
124
|
+
endTime?: number;
|
|
125
|
+
chunkIndex?: number;
|
|
126
|
+
chunkSize?: number;
|
|
89
127
|
}, {
|
|
90
128
|
videoId?: string;
|
|
129
|
+
includeFullTranscript?: boolean;
|
|
130
|
+
includeTimecodes?: boolean;
|
|
131
|
+
startTime?: number;
|
|
132
|
+
endTime?: number;
|
|
133
|
+
chunkIndex?: number;
|
|
134
|
+
chunkSize?: number;
|
|
135
|
+
}>;
|
|
136
|
+
readonly search_transcript: z.ZodObject<{
|
|
137
|
+
videoId: z.ZodString;
|
|
138
|
+
query: z.ZodString;
|
|
139
|
+
maxResults: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
videoId?: string;
|
|
142
|
+
query?: string;
|
|
143
|
+
maxResults?: number;
|
|
144
|
+
}, {
|
|
145
|
+
videoId?: string;
|
|
146
|
+
query?: string;
|
|
147
|
+
maxResults?: number;
|
|
91
148
|
}>;
|
|
92
149
|
readonly find_transcripts: z.ZodObject<{
|
|
93
150
|
query: z.ZodOptional<z.ZodString>;
|
|
@@ -9,6 +9,32 @@ export declare const getTranscriptTool: {
|
|
|
9
9
|
type: string;
|
|
10
10
|
description: string;
|
|
11
11
|
};
|
|
12
|
+
includeFullTranscript: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
default: boolean;
|
|
16
|
+
};
|
|
17
|
+
includeTimecodes: {
|
|
18
|
+
type: string;
|
|
19
|
+
description: string;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
startTime: {
|
|
23
|
+
type: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
endTime: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
chunkIndex: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
chunkSize: {
|
|
35
|
+
type: string;
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
12
38
|
};
|
|
13
39
|
required: string[];
|
|
14
40
|
};
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { Core } from '@strapi/strapi';
|
|
2
2
|
export declare const tools: ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
videoId: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
required: string[];
|
|
14
|
+
};
|
|
15
|
+
} | {
|
|
3
16
|
name: string;
|
|
4
17
|
description: string;
|
|
5
18
|
inputSchema: {
|
|
@@ -23,19 +36,6 @@ export declare const tools: ({
|
|
|
23
36
|
};
|
|
24
37
|
required: any[];
|
|
25
38
|
};
|
|
26
|
-
} | {
|
|
27
|
-
name: string;
|
|
28
|
-
description: string;
|
|
29
|
-
inputSchema: {
|
|
30
|
-
type: "object";
|
|
31
|
-
properties: {
|
|
32
|
-
videoId: {
|
|
33
|
-
type: string;
|
|
34
|
-
description: string;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
required: string[];
|
|
38
|
-
};
|
|
39
39
|
})[];
|
|
40
40
|
/**
|
|
41
41
|
* Handle a tool call by delegating to the appropriate handler
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Core } from '@strapi/strapi';
|
|
2
|
+
export declare const searchTranscriptTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
videoId: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
query: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
maxResults: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
default: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
required: string[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare function handleSearchTranscript(strapi: Core.Strapi, args: unknown): Promise<{
|
|
26
|
+
content: {
|
|
27
|
+
type: "text";
|
|
28
|
+
text: string;
|
|
29
|
+
}[];
|
|
30
|
+
}>;
|
|
@@ -17,7 +17,6 @@ declare const _default: {
|
|
|
17
17
|
}>;
|
|
18
18
|
saveTranscript(payload: Record<string, unknown>): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
19
19
|
findTranscript(videoId: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
20
|
-
generateHumanReadableTranscript(transcript: string): Promise<string>;
|
|
21
20
|
};
|
|
22
21
|
};
|
|
23
22
|
export default _default;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Core } from '@strapi/strapi';
|
|
2
|
-
export declare function generateModifiedTranscript(rawTranscript: string): Promise<string>;
|
|
3
2
|
declare const service: ({ strapi }: {
|
|
4
3
|
strapi: Core.Strapi;
|
|
5
4
|
}) => {
|
|
@@ -18,6 +17,5 @@ declare const service: ({ strapi }: {
|
|
|
18
17
|
}>;
|
|
19
18
|
saveTranscript(payload: Record<string, unknown>): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
20
19
|
findTranscript(videoId: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
21
|
-
generateHumanReadableTranscript(transcript: string): Promise<string>;
|
|
22
20
|
};
|
|
23
21
|
export default service;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.25",
|
|
3
3
|
"keywords": [
|
|
4
4
|
"yt-transcript-strapi-plugin",
|
|
5
5
|
"youtube",
|
|
@@ -39,16 +39,15 @@
|
|
|
39
39
|
"watch:link": "strapi-plugin watch:link",
|
|
40
40
|
"verify": "strapi-plugin verify",
|
|
41
41
|
"test:ts:front": "run -T tsc -p admin/tsconfig.json",
|
|
42
|
-
"test:ts:back": "run -T tsc -p server/tsconfig.json"
|
|
42
|
+
"test:ts:back": "run -T tsc -p server/tsconfig.json",
|
|
43
|
+
"test:mcp": "npx ts-node --project scripts/tsconfig.json scripts/test-mcp.ts",
|
|
44
|
+
"test:mcp:local": "npx ts-node --project scripts/tsconfig.json scripts/test-mcp.ts http://localhost:1337",
|
|
45
|
+
"test:mcp:prod": "npx ts-node --project scripts/tsconfig.json scripts/test-mcp.ts https://deserving-harmony-9f5ca04daf.strapiapp.com"
|
|
43
46
|
},
|
|
44
47
|
"dependencies": {
|
|
45
|
-
"@langchain/core": "^0.3.18",
|
|
46
|
-
"@langchain/openai": "^0.3.14",
|
|
47
|
-
"@langchain/textsplitters": "^0.1.0",
|
|
48
48
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
49
49
|
"@strapi/design-system": "^2.0.0-rc.12",
|
|
50
50
|
"@strapi/icons": "^2.0.0-rc.12",
|
|
51
|
-
"langchain": "^0.3.5",
|
|
52
51
|
"react-intl": "^6.8.7",
|
|
53
52
|
"undici": "^6.21.0",
|
|
54
53
|
"youtubei.js": "^16.0.1",
|
|
@@ -62,6 +61,7 @@
|
|
|
62
61
|
"@strapi/sdk-plugin": "^5.3.2",
|
|
63
62
|
"@strapi/strapi": "^5.33.0",
|
|
64
63
|
"@strapi/typescript-utils": "^5.33.0",
|
|
64
|
+
"@types/node": "^20.0.0",
|
|
65
65
|
"@types/react": "^18.3.12",
|
|
66
66
|
"@types/react-dom": "^18.3.1",
|
|
67
67
|
"prettier": "^3.3.3",
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"react-dom": "^18.3.1",
|
|
70
70
|
"react-router-dom": "^6.28.0",
|
|
71
71
|
"styled-components": "^6.1.13",
|
|
72
|
+
"ts-node": "^10.9.2",
|
|
72
73
|
"typescript": "^5.6.3"
|
|
73
74
|
},
|
|
74
75
|
"peerDependencies": {
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ChatOpenAI } from "@langchain/openai";
|
|
2
|
-
interface InitializeModelProps {
|
|
3
|
-
openAIApiKey: string;
|
|
4
|
-
model: string;
|
|
5
|
-
temp: number;
|
|
6
|
-
maxTokens?: number;
|
|
7
|
-
}
|
|
8
|
-
export declare function initializeModel({ openAIApiKey, model, temp, }: InitializeModelProps): Promise<ChatOpenAI<import("@langchain/openai").ChatOpenAICallOptions>>;
|
|
9
|
-
export {};
|