From cd6e29c9d3a49e5b0ea2a8dcbfd0253996ae9a6d Mon Sep 17 00:00:00 2001
From: hit-cxf <2024111082@stu.hit.edu.cn>
Date: Thu, 14 May 2026 11:10:05 +0800
Subject: [PATCH] 添加了多种风格提示词模版
---
FilmAgent/main.py | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/FilmAgent/main.py b/FilmAgent/main.py
index 72f294a..dba8265 100644
--- a/FilmAgent/main.py
+++ b/FilmAgent/main.py
@@ -3,6 +3,8 @@
from typing import Dict, List, Union
import random
import copy
+import argparse
+
# TO DO
ROOT_PATH = "/path/to/FilmAgent"
@@ -56,7 +58,7 @@
prompt = read_prompt(os.path.join(ROOT_PATH, f"Prompt\{identity}.txt") )
prompt = prompt_format(prompt, params)
log_prompt(self.log_path, prompt)
- result = GPTCall(prompt)
+ result = LLMCall(prompt, model)
if trans2json:
result = clean_text(result)
result = GPTResponse2JSON(result)
@@ -334,7 +336,9 @@
suggestions = ""
for name, suggestion in feedback.items():
suggestions = suggestions + f" - **{name}**: {suggestion}\n"
- params = {"{suggestions}": suggestions}
+ params = {"{suggestions}": suggestions,
+ "{character_profiles}": profiles,
+ "{draft_script}": scenes}
result = self.call("director_5", params)
if result[return_most_similar("adopted-suggestions", list(result.keys()))] == "None":
@@ -495,7 +499,8 @@
all_shots = read_prompt(self.shot_description_path)
params = {"{script}": script, "{all_shots}": all_shots}
result1 = self.call("cinematographer", params)
- result2 = self.call("director_8", params)
+ result2 = self.call("cinematographer", params)
+ # result2 = self.call("director_8", params)
for scene_id, scene in result1.items():
for shot_id, shot in scene.items():
shot.pop("reasoning")
@@ -567,7 +572,8 @@
"{all_shots}": all_shots
}
result = self.call("director_9", params)
- last_shots = current_shot_d if result['better'].lower()=="director" else current_shot_c
+ last_shots = current_shot_d if result['better']=="1" else current_shot_c
+ # last_shots = current_shot_d if result['better'].lower()=="director" else current_shot_c
assert len(list(last_shots.keys())) == len(scenes)
for id in range(len(list(last_shots.keys()))):
@@ -687,6 +693,11 @@
if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--model', help="LLM to be called", type=str)
+ args = parser.parse_args()
+ model = args.model
+
f = FilmCrafter(topic = "Reconcilation in a friend reunion")
print("Characters selecting >>>")
f.casting()
@@ -707,4 +718,4 @@
print("Director discusses with cinematographer about the shots >>>")
f.stage3_verify()
print("Script cleaning >>>")
- f.clean_script()
\ No newline at end of file
+ f.clean_script()
--
Gitblit v1.8.0