Skip to content

Commit b08f3f7

Browse files
authored
Merge pull request #535 from 0xFlicker/fix-videoservice-cache
fix: pass runtime to video service
2 parents 4e85200 + c64074a commit b08f3f7

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

packages/client-discord/src/attachments.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,10 @@ export class AttachmentManager {
335335
}
336336

337337
if (videoService.isVideoUrl(attachment.url)) {
338-
const videoInfo = await videoService.processVideo(attachment.url);
338+
const videoInfo = await videoService.processVideo(
339+
attachment.url,
340+
this.runtime
341+
);
339342
return {
340343
id: attachment.id,
341344
url: attachment.url,

packages/client-discord/src/messages.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -693,15 +693,18 @@ export class MessageManager {
693693
if (
694694
this.runtime
695695
.getService<IVideoService>(ServiceType.VIDEO)
696-
.isVideoUrl(url)
696+
?.isVideoUrl(url)
697697
) {
698698
const videoService = this.runtime.getService<IVideoService>(
699699
ServiceType.VIDEO
700700
);
701701
if (!videoService) {
702702
throw new Error("Video service not found");
703703
}
704-
const videoInfo = await videoService.processVideo(url);
704+
const videoInfo = await videoService.processVideo(
705+
url,
706+
this.runtime
707+
);
705708

706709
attachments.push({
707710
id: `youtube-${Date.now()}`,

packages/core/src/types.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,6 @@ export interface ITranscriptionService extends Service {
10331033

10341034
export interface IVideoService extends Service {
10351035
isVideoUrl(url: string): boolean;
1036-
processVideo(url: string): Promise<Media>;
10371036
fetchVideoInfo(url: string): Promise<Media>;
10381037
downloadVideo(videoInfo: Media): Promise<string>;
10391038
processVideo(url: string, runtime: IAgentRuntime): Promise<Media>;

packages/plugin-node/src/services/video.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class VideoService extends Service implements IVideoService {
9393

9494
public async processVideo(
9595
url: string,
96-
runtime?: IAgentRuntime
96+
runtime: IAgentRuntime
9797
): Promise<Media> {
9898
this.queue.push(url);
9999
this.processQueue(runtime);

0 commit comments

Comments
 (0)