Skip to content

Commit 0231168

Browse files
committed
fix: update video format handling in base_video_understand_node.py
1 parent 28d403f commit 0231168

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

apps/application/flow/step_node/video_understand_step_node/impl/base_video_understand_node.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from application.flow.i_step_node import NodeResult, INode
1313
from application.flow.step_node.video_understand_step_node.i_video_understand_node import IVideoUnderstandNode
1414
from knowledge.models import File
15+
from models_provider.impl.volcanic_engine_model_provider.model.image import get_video_format
1516
from models_provider.tools import get_model_instance_by_model_workspace_id
1617

1718

@@ -62,7 +63,7 @@ def file_id_to_base64(file_id: str):
6263
file = QuerySet(File).filter(id=file_id).first()
6364
file_bytes = file.get_bytes()
6465
base64_video = base64.b64encode(file_bytes).decode("utf-8")
65-
return [base64_video, what(None, file_bytes)]
66+
return [base64_video, get_video_format(file.file_name)]
6667

6768

6869
class BaseVideoUnderstandNode(IVideoUnderstandNode):
@@ -160,7 +161,7 @@ def generate_history_human_message(self, chat_record):
160161
content=[
161162
{'type': 'text', 'text': data['question']},
162163
*[{'type': 'video_url',
163-
'video_url': {'url': f'data:video/{base64_video[1]};base64,{base64_video[0]}'}} for
164+
'video_url': {'url': f'data:{base64_video[1]};base64,{base64_video[0]}'}} for
164165
base64_video in video_base64_list]
165166
])
166167
return HumanMessage(content=chat_record.problem_text)

0 commit comments

Comments
 (0)