Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -589,39 +589,39 @@ class WebSearchIntegration:
|
|
| 589 |
return "\n".join(extracted)
|
| 590 |
|
| 591 |
class ScreenplayGenerationSystem:
|
| 592 |
-
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
| 596 |
-
|
| 597 |
-
|
| 598 |
-
|
| 599 |
-
|
| 600 |
-
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
|
| 626 |
**์์ฒญ์ฌํญ:** {user_query}
|
| 627 |
**ํ์
:** {SCREENPLAY_LENGTHS[screenplay_type]['description']}
|
|
@@ -633,42 +633,42 @@ class ScreenplayGenerationSystem:
|
|
| 633 |
**ํ์ ์ ๊ณต ํญ๋ชฉ:**
|
| 634 |
|
| 635 |
1. **์ ๋ชฉ (TITLE)**
|
| 636 |
-
|
| 637 |
-
|
| 638 |
|
| 639 |
2. **๋ก๊ทธ๋ผ์ธ (LOGLINE)**
|
| 640 |
-
|
| 641 |
-
|
| 642 |
-
|
| 643 |
|
| 644 |
3. **์ฅ๋ฅด ๋ถ์**
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
| 648 |
|
| 649 |
4. **ํ๊ฒ ๊ด๊ฐ**
|
| 650 |
-
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
|
| 655 |
5. **๋น๊ต ์ํ (COMPS)**
|
| 656 |
-
|
| 657 |
-
|
| 658 |
-
|
| 659 |
|
| 660 |
6. **๊ณ ์ ํ๋งค ํฌ์ธํธ (USP)**
|
| 661 |
-
|
| 662 |
-
|
| 663 |
-
|
| 664 |
|
| 665 |
7. **๋น์ฃผ์ผ ์ปจ์
**
|
| 666 |
-
|
| 667 |
-
|
| 668 |
|
| 669 |
๊ตฌ์ฒด์ ์ด๊ณ ์์ฅ์ฑ ์๋ ์ปจ์
์ ์ ์ํ์ธ์.""",
|
| 670 |
|
| 671 |
-
|
| 672 |
|
| 673 |
**Request:** {user_query}
|
| 674 |
**Type:** {SCREENPLAY_LENGTHS[screenplay_type]['description']}
|
|
@@ -680,52 +680,52 @@ class ScreenplayGenerationSystem:
|
|
| 680 |
**Required Elements:**
|
| 681 |
|
| 682 |
1. **TITLE**
|
| 683 |
-
|
| 684 |
-
|
| 685 |
|
| 686 |
2. **LOGLINE**
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
|
| 690 |
|
| 691 |
3. **GENRE ANALYSIS**
|
| 692 |
-
|
| 693 |
-
|
| 694 |
-
|
| 695 |
|
| 696 |
4. **TARGET AUDIENCE**
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
| 700 |
-
|
| 701 |
|
| 702 |
5. **COMPARABLE FILMS (COMPS)**
|
| 703 |
-
|
| 704 |
-
|
| 705 |
-
|
| 706 |
|
| 707 |
6. **UNIQUE SELLING POINT (USP)**
|
| 708 |
-
|
| 709 |
-
|
| 710 |
-
|
| 711 |
|
| 712 |
7. **VISUAL CONCEPT**
|
| 713 |
-
|
| 714 |
-
|
| 715 |
|
| 716 |
Provide specific, marketable concept."""
|
| 717 |
-
|
| 718 |
-
|
| 719 |
-
|
| 720 |
|
| 721 |
-
|
| 722 |
-
|
| 723 |
-
|
| 724 |
-
|
| 725 |
-
|
| 726 |
-
|
| 727 |
-
|
| 728 |
-
|
| 729 |
|
| 730 |
**ํ๋ก๋์ ์ปจ์
:**
|
| 731 |
{producer_concept}
|
|
@@ -738,54 +738,54 @@ Provide specific, marketable concept."""
|
|
| 738 |
**ํ์ ์์ฑ ํญ๋ชฉ:**
|
| 739 |
|
| 740 |
1. **์๋์์ค (SYNOPSIS)**
|
| 741 |
-
|
| 742 |
-
|
| 743 |
-
|
| 744 |
-
|
| 745 |
-
|
| 746 |
|
| 747 |
2. **3๋ง ๊ตฌ์กฐ (THREE-ACT STRUCTURE)**
|
| 748 |
-
|
| 749 |
-
|
| 750 |
-
|
| 751 |
-
|
| 752 |
-
|
| 753 |
-
|
| 754 |
-
|
| 755 |
-
|
| 756 |
-
|
| 757 |
-
|
| 758 |
-
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
|
| 762 |
-
|
| 763 |
-
|
| 764 |
-
|
| 765 |
-
|
| 766 |
-
|
| 767 |
-
|
| 768 |
-
|
| 769 |
-
|
| 770 |
-
|
| 771 |
-
|
| 772 |
|
| 773 |
3. **Save the Cat ๋นํธ ์ํธ**
|
| 774 |
-
|
| 775 |
|
| 776 |
4. **์ฃผ์ (THEME)**
|
| 777 |
-
|
| 778 |
-
|
| 779 |
-
|
| 780 |
|
| 781 |
5. **ํค & ์คํ์ผ**
|
| 782 |
-
|
| 783 |
-
|
| 784 |
-
|
| 785 |
|
| 786 |
๊ตฌ์ฒด์ ์ด๊ณ ๊ฐ์ ์ ์ผ๋ก ๊ณต๊ฐ๊ฐ๋ ์คํ ๋ฆฌ๋ฅผ ๋ง๋์ธ์.""",
|
| 787 |
|
| 788 |
-
|
| 789 |
|
| 790 |
**Producer Concept:**
|
| 791 |
{producer_concept}
|
|
@@ -798,62 +798,62 @@ Provide specific, marketable concept."""
|
|
| 798 |
**Required Elements:**
|
| 799 |
|
| 800 |
1. **SYNOPSIS**
|
| 801 |
-
|
| 802 |
-
|
| 803 |
-
|
| 804 |
-
|
| 805 |
-
|
| 806 |
|
| 807 |
2. **THREE-ACT STRUCTURE**
|
| 808 |
-
|
| 809 |
-
|
| 810 |
-
|
| 811 |
-
|
| 812 |
-
|
| 813 |
-
|
| 814 |
-
|
| 815 |
-
|
| 816 |
-
|
| 817 |
-
|
| 818 |
-
|
| 819 |
-
|
| 820 |
-
|
| 821 |
-
|
| 822 |
-
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
|
| 827 |
-
|
| 828 |
-
|
| 829 |
-
|
| 830 |
-
|
| 831 |
-
|
| 832 |
|
| 833 |
3. **SAVE THE CAT BEAT SHEET**
|
| 834 |
-
|
| 835 |
|
| 836 |
4. **THEME**
|
| 837 |
-
|
| 838 |
-
|
| 839 |
-
|
| 840 |
|
| 841 |
5. **TONE & STYLE**
|
| 842 |
-
|
| 843 |
-
|
| 844 |
-
|
| 845 |
|
| 846 |
Create specific, emotionally resonant story."""
|
| 847 |
-
|
| 848 |
-
|
| 849 |
-
|
| 850 |
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
-
|
| 855 |
-
|
| 856 |
-
|
| 857 |
|
| 858 |
**ํ๋ก๋์ ์ปจ์
:**
|
| 859 |
{producer_concept}
|
|
@@ -864,53 +864,53 @@ Create specific, emotionally resonant story."""
|
|
| 864 |
**ํ์ ์บ๋ฆญํฐ ํ๋กํ:**
|
| 865 |
|
| 866 |
1. **์ฃผ์ธ๊ณต (PROTAGONIST)**
|
| 867 |
-
|
| 868 |
-
|
| 869 |
-
|
| 870 |
-
|
| 871 |
-
|
| 872 |
-
|
| 873 |
-
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
|
| 878 |
|
| 879 |
2. **์ ๋์ (ANTAGONIST)**
|
| 880 |
-
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
|
| 884 |
-
|
| 885 |
-
|
| 886 |
-
|
| 887 |
-
|
| 888 |
|
| 889 |
3. **์กฐ๋ ฅ์๋ค (SUPPORTING CAST)**
|
| 890 |
-
|
| 891 |
-
|
| 892 |
-
|
| 893 |
-
|
| 894 |
-
|
| 895 |
-
|
| 896 |
|
| 897 |
4. **์บ๋ฆญํฐ ๊ด๊ณ๋**
|
| 898 |
-
|
| 899 |
-
|
| 900 |
-
|
| 901 |
-
|
| 902 |
|
| 903 |
5. **์บ์คํ
์ ์**
|
| 904 |
-
|
| 905 |
-
|
| 906 |
|
| 907 |
6. **๋ํ ์ํ**
|
| 908 |
-
|
| 909 |
-
|
| 910 |
|
| 911 |
๊ฐ ์บ๋ฆญํฐ๊ฐ ํ
๋ง๋ฅผ ๊ตฌํํ๊ณ ์คํ ๋ฆฌ๋ฅผ ์ถ์งํ๋๋ก ๋์์ธํ์ธ์.""",
|
| 912 |
|
| 913 |
-
|
| 914 |
|
| 915 |
**Producer Concept:**
|
| 916 |
{producer_concept}
|
|
@@ -921,63 +921,63 @@ Create specific, emotionally resonant story."""
|
|
| 921 |
**Required Character Profiles:**
|
| 922 |
|
| 923 |
1. **PROTAGONIST**
|
| 924 |
-
|
| 925 |
-
|
| 926 |
-
|
| 927 |
-
|
| 928 |
-
|
| 929 |
-
|
| 930 |
-
|
| 931 |
-
|
| 932 |
-
|
| 933 |
-
|
| 934 |
-
|
| 935 |
|
| 936 |
2. **ANTAGONIST**
|
| 937 |
-
|
| 938 |
-
|
| 939 |
-
|
| 940 |
-
|
| 941 |
-
|
| 942 |
-
|
| 943 |
-
|
| 944 |
-
|
| 945 |
|
| 946 |
3. **SUPPORTING CAST**
|
| 947 |
-
|
| 948 |
-
|
| 949 |
-
|
| 950 |
-
|
| 951 |
-
|
| 952 |
-
|
| 953 |
|
| 954 |
4. **CHARACTER RELATIONSHIPS**
|
| 955 |
-
|
| 956 |
-
|
| 957 |
-
|
| 958 |
-
|
| 959 |
|
| 960 |
5. **CASTING SUGGESTIONS**
|
| 961 |
-
|
| 962 |
-
|
| 963 |
|
| 964 |
6. **DIALOGUE SAMPLES**
|
| 965 |
-
|
| 966 |
-
|
| 967 |
|
| 968 |
Design each character to embody theme and drive story."""
|
| 969 |
-
|
| 970 |
-
|
| 971 |
-
|
| 972 |
|
| 973 |
-
|
| 974 |
-
|
| 975 |
-
|
| 976 |
-
|
| 977 |
-
|
| 978 |
-
|
| 979 |
-
|
| 980 |
-
|
| 981 |
|
| 982 |
**์คํ ๋ฆฌ ๊ตฌ์กฐ:**
|
| 983 |
{story_structure}
|
|
@@ -1015,7 +1015,7 @@ Design each character to embody theme and drive story."""
|
|
| 1015 |
|
| 1016 |
๊ฐ ์ฌ์ด ์คํ ๋ฆฌ๋ฅผ ์ ์ง์ํค๊ณ ์บ๋ฆญํฐ๋ฅผ ๋ฐ์ ์ํค๋๋ก ๊ณํํ์ธ์.""",
|
| 1017 |
|
| 1018 |
-
|
| 1019 |
|
| 1020 |
**Story Structure:**
|
| 1021 |
{story_structure}
|
|
@@ -1052,19 +1052,19 @@ For each scene provide:
|
|
| 1052 |
- DISSOLVE TO:
|
| 1053 |
|
| 1054 |
Plan each scene to advance story and develop character."""
|
| 1055 |
-
|
| 1056 |
-
|
| 1057 |
-
|
| 1058 |
|
| 1059 |
-
|
| 1060 |
-
|
| 1061 |
-
|
| 1062 |
-
|
| 1063 |
-
|
| 1064 |
-
|
| 1065 |
-
|
| 1066 |
-
|
| 1067 |
-
|
| 1068 |
|
| 1069 |
**ํ๊ฒ ๋ถ๋:** {act_pages}ํ์ด์ง
|
| 1070 |
|
|
@@ -1080,29 +1080,29 @@ Plan each scene to advance story and develop character."""
|
|
| 1080 |
**์๋๋ฆฌ์ค ํฌ๋งท ๊ท์น:**
|
| 1081 |
|
| 1082 |
1. **์ฌ ํค๋ฉ**
|
| 1083 |
-
|
| 1084 |
-
|
| 1085 |
|
| 1086 |
2. **์ก์
๋ผ์ธ**
|
| 1087 |
-
|
| 1088 |
-
|
| 1089 |
-
|
| 1090 |
-
|
| 1091 |
|
| 1092 |
3. **์บ๋ฆญํฐ ์๊ฐ**
|
| 1093 |
-
|
| 1094 |
|
| 1095 |
4. **๋ํ**
|
| 1096 |
-
|
| 1097 |
-
|
| 1098 |
-
|
| 1099 |
|
| 1100 |
5. **์ค์ ์์น**
|
| 1101 |
-
|
| 1102 |
-
|
| 1103 |
-
|
| 1104 |
-
|
| 1105 |
-
|
| 1106 |
|
| 1107 |
**{genre} ์ฅ๋ฅด ํน์ฑ:**
|
| 1108 |
- ๋ํ ๋น์จ: {GENRE_TEMPLATES[genre]['dialogue_ratio']*100}%
|
|
@@ -1111,7 +1111,7 @@ Plan each scene to advance story and develop character."""
|
|
| 1111 |
|
| 1112 |
์ ํํ ํฌ๋งท๊ณผ ๋ชฐ์
๊ฐ ์๋ ์คํ ๋ฆฌํ
๋ง์ผ๋ก ์์ฑํ์ธ์.""",
|
| 1113 |
|
| 1114 |
-
|
| 1115 |
|
| 1116 |
**Target Length:** {act_pages} pages
|
| 1117 |
|
|
@@ -1127,29 +1127,29 @@ Plan each scene to advance story and develop character."""
|
|
| 1127 |
**Screenplay Format Rules:**
|
| 1128 |
|
| 1129 |
1. **Scene Headings**
|
| 1130 |
-
|
| 1131 |
-
|
| 1132 |
|
| 1133 |
2. **Action Lines**
|
| 1134 |
-
|
| 1135 |
-
|
| 1136 |
-
|
| 1137 |
-
|
| 1138 |
|
| 1139 |
3. **Character Intros**
|
| 1140 |
-
|
| 1141 |
|
| 1142 |
4. **Dialogue**
|
| 1143 |
-
|
| 1144 |
-
|
| 1145 |
-
|
| 1146 |
|
| 1147 |
5. **Key Principles**
|
| 1148 |
-
|
| 1149 |
-
|
| 1150 |
-
|
| 1151 |
-
|
| 1152 |
-
|
| 1153 |
|
| 1154 |
**{genre} Genre Characteristics:**
|
| 1155 |
- Dialogue Ratio: {GENRE_TEMPLATES[genre]['dialogue_ratio']*100}%
|
|
@@ -1157,16 +1157,16 @@ Plan each scene to advance story and develop character."""
|
|
| 1157 |
- Key Elements: {', '.join(GENRE_TEMPLATES[genre]['key_elements'][:2])}
|
| 1158 |
|
| 1159 |
Write with proper format and engaging storytelling."""
|
| 1160 |
-
|
| 1161 |
-
|
| 1162 |
-
|
| 1163 |
|
| 1164 |
-
|
| 1165 |
-
|
| 1166 |
-
|
| 1167 |
-
|
| 1168 |
-
|
| 1169 |
-
|
| 1170 |
|
| 1171 |
**์์ฑ๋ ๋ด์ฉ:**
|
| 1172 |
{act_content}
|
|
@@ -1174,37 +1174,37 @@ Write with proper format and engaging storytelling."""
|
|
| 1174 |
**๊ฒํ ํญ๋ชฉ:**
|
| 1175 |
|
| 1176 |
1. **ํฌ๋งท ์ ํ์ฑ**
|
| 1177 |
-
|
| 1178 |
-
|
| 1179 |
-
|
| 1180 |
-
|
| 1181 |
|
| 1182 |
2. **์คํ ๋ฆฌํ
๋ง**
|
| 1183 |
-
|
| 1184 |
-
|
| 1185 |
-
|
| 1186 |
-
|
| 1187 |
|
| 1188 |
3. **๋ํ ํ์ง**
|
| 1189 |
-
|
| 1190 |
-
|
| 1191 |
-
|
| 1192 |
-
|
| 1193 |
|
| 1194 |
4. **{genre} ์ฅ๋ฅด ์ ํฉ์ฑ**
|
| 1195 |
-
|
| 1196 |
-
|
| 1197 |
-
|
| 1198 |
|
| 1199 |
5. **๊ธฐ์ ์ ์ธก๋ฉด**
|
| 1200 |
-
|
| 1201 |
-
|
| 1202 |
-
|
| 1203 |
|
| 1204 |
**ํ์ ๊ฐ์ ์ฌํญ:**
|
| 1205 |
๊ตฌ์ฒด์ ์ธ ์์ ์ ์๊ณผ ๊ฐ์ ๋ ์์๋ฅผ ์ ๊ณตํ์ธ์.""",
|
| 1206 |
|
| 1207 |
-
|
| 1208 |
|
| 1209 |
**Written Content:**
|
| 1210 |
{act_content}
|
|
@@ -1212,71 +1212,71 @@ Write with proper format and engaging storytelling."""
|
|
| 1212 |
**Review Areas:**
|
| 1213 |
|
| 1214 |
1. **Format Accuracy**
|
| 1215 |
-
|
| 1216 |
-
|
| 1217 |
-
|
| 1218 |
-
|
| 1219 |
|
| 1220 |
2. **Storytelling**
|
| 1221 |
-
|
| 1222 |
-
|
| 1223 |
-
|
| 1224 |
-
|
| 1225 |
|
| 1226 |
3. **Dialogue Quality**
|
| 1227 |
-
|
| 1228 |
-
|
| 1229 |
-
|
| 1230 |
-
|
| 1231 |
|
| 1232 |
4. **{genre} Genre Fit**
|
| 1233 |
-
|
| 1234 |
-
|
| 1235 |
-
|
| 1236 |
|
| 1237 |
5. **Technical Aspects**
|
| 1238 |
-
|
| 1239 |
-
|
| 1240 |
-
|
| 1241 |
|
| 1242 |
**Required Improvements:**
|
| 1243 |
Provide specific revision suggestions with improved examples."""
|
| 1244 |
-
|
| 1245 |
-
|
| 1246 |
-
|
| 1247 |
|
| 1248 |
-
|
| 1249 |
-
|
| 1250 |
-
|
| 1251 |
-
|
| 1252 |
-
|
| 1253 |
-
|
| 1254 |
|
| 1255 |
**ํ๊ฐ ๊ธฐ์ค:**
|
| 1256 |
|
| 1257 |
1. **์์
์ฑ (25์ )**
|
| 1258 |
-
|
| 1259 |
-
|
| 1260 |
-
|
| 1261 |
-
|
| 1262 |
|
| 1263 |
2. **์คํ ๋ฆฌ (25์ )**
|
| 1264 |
-
|
| 1265 |
-
|
| 1266 |
-
|
| 1267 |
-
|
| 1268 |
|
| 1269 |
3. **๊ธฐ์ ์ ์์ฑ๋ (25์ )**
|
| 1270 |
-
|
| 1271 |
-
|
| 1272 |
-
|
| 1273 |
-
|
| 1274 |
|
| 1275 |
4. **๋ํ & ์บ๋ฆญํฐ (25์ )**
|
| 1276 |
-
|
| 1277 |
-
|
| 1278 |
-
|
| 1279 |
-
|
| 1280 |
|
| 1281 |
**์ข
ํฉ ํ๊ฐ:**
|
| 1282 |
- ๊ฐ์ (3-5๊ฐ)
|
|
@@ -1288,33 +1288,33 @@ Provide specific revision suggestions with improved examples."""
|
|
| 1288 |
|
| 1289 |
๊ตฌ์ฒด์ ์ด๊ณ ๊ฑด์ค์ ์ธ ํผ๋๋ฐฑ์ ์ ๊ณตํ์ธ์.""",
|
| 1290 |
|
| 1291 |
-
|
| 1292 |
|
| 1293 |
**Evaluation Criteria:**
|
| 1294 |
|
| 1295 |
1. **Commercial Viability (25 points)**
|
| 1296 |
-
|
| 1297 |
-
|
| 1298 |
-
|
| 1299 |
-
|
| 1300 |
|
| 1301 |
2. **Story (25 points)**
|
| 1302 |
-
|
| 1303 |
-
|
| 1304 |
-
|
| 1305 |
-
|
| 1306 |
|
| 1307 |
3. **Technical Excellence (25 points)**
|
| 1308 |
-
|
| 1309 |
-
|
| 1310 |
-
|
| 1311 |
-
|
| 1312 |
|
| 1313 |
4. **Dialogue & Character (25 points)**
|
| 1314 |
-
|
| 1315 |
-
|
| 1316 |
-
|
| 1317 |
-
|
| 1318 |
|
| 1319 |
**Overall Assessment:**
|
| 1320 |
- Strengths (3-5)
|
|
@@ -1325,218 +1325,307 @@ Provide specific revision suggestions with improved examples."""
|
|
| 1325 |
**Grade:** A+ to F
|
| 1326 |
|
| 1327 |
Provide specific, constructive feedback."""
|
| 1328 |
-
|
| 1329 |
-
|
| 1330 |
-
|
| 1331 |
-
|
| 1332 |
-
def _get_genre_scene_guidelines(self, genre: str, language: str) -> str:
|
| 1333 |
-
"""Get genre-specific scene guidelines"""
|
| 1334 |
-
guidelines = {
|
| 1335 |
-
"action": {
|
| 1336 |
-
"Korean": "- ์งง๊ณ ํ์น๊ฐ ์๋ ์ฌ\n- ์ก์
์ํ์ค ์์ธ ๊ณํ\n- ๊ธด์ฅ๊ฐ ์ง์",
|
| 1337 |
-
"English": "- Short, punchy scenes\n- Detailed action sequences\n- Maintain tension"
|
| 1338 |
-
},
|
| 1339 |
-
"thriller": {
|
| 1340 |
-
"Korean": "- ์์คํ์ค ๊ตฌ์ถ\n- ์ ๋ณด ์ ์ง์ ๊ณต๊ฐ\n- ๋ฐ์ ๋ฐฐ์น",
|
| 1341 |
-
"English": "- Build suspense\n- Gradual information reveal\n- Place twists"
|
| 1342 |
-
},
|
| 1343 |
-
"drama": {
|
| 1344 |
-
"Korean": "- ๊ฐ์ ์ ๋นํธ ๊ฐ์กฐ\n- ์บ๋ฆญํฐ ์ค์ฌ ์ฌ\n- ๋ํ ๊ณต๊ฐ ํ๋ณด",
|
| 1345 |
-
"English": "- Emphasize emotional beats\n- Character-driven scenes\n- Allow dialogue space"
|
| 1346 |
-
},
|
| 1347 |
-
"comedy": {
|
| 1348 |
-
"Korean": "- ์
์
๊ณผ ํ์ด์คํ\n- ์ฝ๋ฏน ํ์ด๋ฐ\n- ์๊ฐ์ ๊ฐ๊ทธ",
|
| 1349 |
-
"English": "- Setup and payoff\n- Comic timing\n- Visual gags"
|
| 1350 |
-
},
|
| 1351 |
-
"horror": {
|
| 1352 |
-
"Korean": "- ๋ถ์๊ธฐ ์กฐ์ฑ\n- ์ ํ ์ค์ผ์ด ๋ฐฐ์น\n- ๊ธด์ฅ๊ณผ ์ด์",
|
| 1353 |
-
"English": "- Atmosphere building\n- Jump scare placement\n- Tension and release"
|
| 1354 |
-
},
|
| 1355 |
-
"sci-fi": {
|
| 1356 |
-
"Korean": "- ์ธ๊ณ๊ด ์ค๋ช
\n- ์๊ฐ์ ์คํํฐํด\n- ๊ฐ๋
์๊ฐ",
|
| 1357 |
-
"English": "- World building\n- Visual spectacle\n- Concept introduction"
|
| 1358 |
-
},
|
| 1359 |
-
"romance": {
|
| 1360 |
-
"Korean": "- ๊ฐ์ ์ ์น๋ฐ๊ฐ\n- ๊ด๊ณ ๋ฐ์ \n- ๋ก๋งจํฑ ๋นํธ",
|
| 1361 |
-
"English": "- Emotional intimacy\n- Relationship progression\n- Romantic beats"
|
| 1362 |
-
}
|
| 1363 |
-
}
|
| 1364 |
-
|
| 1365 |
-
return guidelines.get(genre, guidelines["drama"]).get(language, "")
|
| 1366 |
-
|
| 1367 |
-
def _extract_act_scenes(self, scene_breakdown: str, act: str) -> str:
|
| 1368 |
-
"""Extract scenes for specific act"""
|
| 1369 |
-
# This would parse the scene breakdown and return only scenes for the requested act
|
| 1370 |
-
# For now, returning a placeholder
|
| 1371 |
-
return f"Scenes for {act} from the breakdown"
|
| 1372 |
-
|
| 1373 |
-
# --- LLM call functions ---
|
| 1374 |
-
def call_llm_sync(self, messages: List[Dict[str, str]], role: str, language: str) -> str:
|
| 1375 |
-
full_content = ""
|
| 1376 |
-
for chunk in self.call_llm_streaming(messages, role, language):
|
| 1377 |
-
full_content += chunk
|
| 1378 |
-
if full_content.startswith("โ"):
|
| 1379 |
-
raise Exception(f"LLM Call Failed: {full_content}")
|
| 1380 |
-
return full_content
|
| 1381 |
-
|
| 1382 |
-
def call_llm_streaming(self, messages: List[Dict[str, str]], role: str,
|
| 1383 |
-
language: str) -> Generator[str, None, None]:
|
| 1384 |
-
try:
|
| 1385 |
-
system_prompts = self.get_system_prompts(language)
|
| 1386 |
-
full_messages = [{"role": "system", "content": system_prompts.get(role, "")}, *messages]
|
| 1387 |
-
|
| 1388 |
-
max_tokens = 15000 if role == "screenwriter" else 8000
|
| 1389 |
-
|
| 1390 |
-
payload = {
|
| 1391 |
-
"model": self.model_id,
|
| 1392 |
-
"messages": full_messages,
|
| 1393 |
-
"max_tokens": max_tokens,
|
| 1394 |
-
"temperature": 0.7 if role in ["screenwriter", "script_doctor"] else 0.8,
|
| 1395 |
-
"top_p": 0.9,
|
| 1396 |
-
"presence_penalty": 0.3,
|
| 1397 |
-
"frequency_penalty": 0.3,
|
| 1398 |
-
"stream": True
|
| 1399 |
-
}
|
| 1400 |
-
|
| 1401 |
-
response = requests.post(
|
| 1402 |
-
self.api_url,
|
| 1403 |
-
headers=self.create_headers(),
|
| 1404 |
-
json=payload,
|
| 1405 |
-
stream=True,
|
| 1406 |
-
timeout=180
|
| 1407 |
-
)
|
| 1408 |
-
|
| 1409 |
-
if response.status_code != 200:
|
| 1410 |
-
yield f"โ API Error (Status Code: {response.status_code})"
|
| 1411 |
-
return
|
| 1412 |
-
|
| 1413 |
-
buffer = ""
|
| 1414 |
-
for line in response.iter_lines():
|
| 1415 |
-
if not line:
|
| 1416 |
-
continue
|
| 1417 |
-
|
| 1418 |
-
try:
|
| 1419 |
-
line_str = line.decode('utf-8').strip()
|
| 1420 |
-
if not line_str.startswith("data: "):
|
| 1421 |
-
continue
|
| 1422 |
-
|
| 1423 |
-
data_str = line_str[6:]
|
| 1424 |
-
if data_str == "[DONE]":
|
| 1425 |
-
break
|
| 1426 |
-
|
| 1427 |
-
data = json.loads(data_str)
|
| 1428 |
-
choices = data.get("choices", [])
|
| 1429 |
-
if choices and choices[0].get("delta", {}).get("content"):
|
| 1430 |
-
content = choices[0]["delta"]["content"]
|
| 1431 |
-
buffer += content
|
| 1432 |
-
|
| 1433 |
-
if len(buffer) >= 50 or '\n' in buffer:
|
| 1434 |
-
yield buffer
|
| 1435 |
-
buffer = ""
|
| 1436 |
-
time.sleep(0.01)
|
| 1437 |
-
|
| 1438 |
-
except Exception as e:
|
| 1439 |
-
logger.error(f"Chunk processing error: {str(e)}")
|
| 1440 |
-
continue
|
| 1441 |
-
|
| 1442 |
-
if buffer:
|
| 1443 |
-
yield buffer
|
| 1444 |
-
|
| 1445 |
-
except Exception as e:
|
| 1446 |
-
logger.error(f"Streaming error: {type(e).__name__}: {str(e)}")
|
| 1447 |
-
yield f"โ Error occurred: {str(e)}"
|
| 1448 |
|
| 1449 |
-
|
| 1450 |
-
|
| 1451 |
-
|
| 1452 |
-
|
| 1453 |
-
|
| 1454 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1455 |
์์
์ ์ฑ๊ณต๊ณผ ์์ ์ ๊ฐ์น๋ฅผ ๋ชจ๋ ์ถ๊ตฌํฉ๋๋ค.
|
| 1456 |
์์ฅ ํธ๋ ๋์ ๊ด๊ฐ ์ฌ๋ฆฌ๋ฅผ ์ ํํ ํ์
ํฉ๋๋ค.
|
| 1457 |
์คํ ๊ฐ๋ฅํ๊ณ ๋งค๋ ฅ์ ์ธ ํ๋ก์ ํธ๋ฅผ ๊ฐ๋ฐํฉ๋๋ค.""",
|
| 1458 |
-
|
| 1459 |
-
|
| 1460 |
๊ฐ์ ์ ์ผ๋ก ๊ณต๊ฐ๊ฐ๊ณ ๊ตฌ์กฐ์ ์ผ๋ก ํํํ ์ด์ผ๊ธฐ๋ฅผ ๋ง๋ญ๋๋ค.
|
| 1461 |
์บ๋ฆญํฐ์ ๋ด์ ์ฌ์ ๊ณผ ์ธ์ ๏ฟฝ๏ฟฝ๏ฟฝ๋กฏ์ ์กฐํ๋กญ๊ฒ ์ฎ์ต๋๋ค.
|
| 1462 |
๋ณดํธ์ ์ฃผ์ ๋ฅผ ๋
ํนํ ๋ฐฉ์์ผ๋ก ํ๊ตฌํฉ๋๋ค.""",
|
| 1463 |
-
|
| 1464 |
-
|
| 1465 |
์ง์ง ๊ฐ์ ์ธ๋ฌผ๋ค์ ์ฐฝ์กฐํ๋ ์ ๋ฌธ๊ฐ์
๋๋ค.
|
| 1466 |
๊ฐ ์บ๋ฆญํฐ์๊ฒ ๊ณ ์ ํ ๋ชฉ์๋ฆฌ์ ๊ด์ ์ ๋ถ์ฌํฉ๋๋ค.
|
| 1467 |
๋ณต์กํ๊ณ ๋ชจ์์ ์ธ ์ธ๊ฐ์ฑ์ ํฌ์ฐฉํฉ๋๋ค.""",
|
| 1468 |
-
|
| 1469 |
-
|
| 1470 |
๊ฐ ์ฌ์ด ์คํ ๋ฆฌ์ ์บ๋ฆญํฐ๋ฅผ ์ ์ง์ํค๋๋ก ์ค๊ณํฉ๋๋ค.
|
| 1471 |
๋ฆฌ๋ฌ๊ณผ ํ์ด์ฑ์ ์๋ฒฝํ๊ฒ ์กฐ์ ํฉ๋๋ค.
|
| 1472 |
์๊ฐ์ ์คํ ๋ฆฌํ
๋ง์ ๊ทน๋ํํฉ๋๋ค.""",
|
| 1473 |
-
|
| 1474 |
-
|
| 1475 |
'๋ณด์ฌ์ฃผ๊ธฐ'์ ๋๊ฐ์ด๋ฉฐ ์๋ธํ
์คํธ๋ฅผ ๋ฅ์ํ๊ฒ ๋ค๋ฃน๋๋ค.
|
| 1476 |
์์ํ๊ณ ์์ฐ์ค๋ฌ์ด ๋ํ๋ฅผ ์ฐ๋ ์ ๋ฌธ๊ฐ์
๋๋ค.
|
| 1477 |
์ ์ ํ์ค์ ๊ณ ๋ คํ๋ฉด์๋ ์ฐฝ์์ ์ธ ํด๊ฒฐ์ฑ
์ ์ฐพ์ต๋๋ค.""",
|
| 1478 |
-
|
| 1479 |
-
|
| 1480 |
์์ ๋ํ
์ผ๋ ๋์น์ง ์๋ ์๋ฒฝ์ฃผ์์์
๋๋ค.
|
| 1481 |
์คํ ๋ฆฌ์ ์ ์ฌ๋ ฅ์ ์ต๋ํ ๋์ด๋
๋๋ค.
|
| 1482 |
๊ฑด์ค์ ์ด๊ณ ๊ตฌ์ฒด์ ์ธ ๊ฐ์ ์์ ์ ์ํฉ๋๋ค.""",
|
| 1483 |
-
|
| 1484 |
-
|
| 1485 |
์คํ ๋ฆฌ์ ๋ผ๋์ ๊ทผ์ก์ ๊ฟฐ๋ซ์ด ๋ด
๋๋ค.
|
| 1486 |
๋
ผ๋ฆฌ์ ํ์ ๊ณผ ๊ฐ์ ์ ๊ณต๋ฐฑ์ ์ฐพ์๋
๋๋ค.
|
| 1487 |
๋ ๋์ ๊ตฌ์กฐ๋ฅผ ์ํ ๊ตฌ์ฒด์ ์ ์์ ํฉ๋๋ค.""",
|
| 1488 |
-
|
| 1489 |
-
|
| 1490 |
์์
์ฑ๊ณผ ์์ ์ฑ์ ๊ท ํ์๊ฒ ํ๊ฐํฉ๋๋ค.
|
| 1491 |
์ ์์ฌ, ๋ฐฐ์ฐ, ๊ด๊ฐ ๋ชจ๋ ๊ด์ ์ ๊ณ ๋ คํฉ๋๋ค.
|
| 1492 |
๋์ ํ์ง๋ง ๊ฒฉ๋ คํ๋ ํผ๋๋ฐฑ์ ์ ๊ณตํฉ๋๋ค."""
|
| 1493 |
-
|
| 1494 |
-
|
| 1495 |
-
|
| 1496 |
You pursue both commercial success and artistic value.
|
| 1497 |
You accurately grasp market trends and audience psychology.
|
| 1498 |
You develop feasible and attractive projects.""",
|
| 1499 |
-
|
| 1500 |
-
|
| 1501 |
You create emotionally resonant and structurally sound stories.
|
| 1502 |
You harmoniously weave internal journeys with external plots.
|
| 1503 |
You explore universal themes in unique ways.""",
|
| 1504 |
-
|
| 1505 |
-
|
| 1506 |
You're an expert at creating lifelike characters.
|
| 1507 |
You give each character a unique voice and perspective.
|
| 1508 |
You capture complex and contradictory humanity.""",
|
| 1509 |
-
|
| 1510 |
-
|
| 1511 |
You design each scene to advance story and character.
|
| 1512 |
You perfectly control rhythm and pacing.
|
| 1513 |
You maximize visual storytelling.""",
|
| 1514 |
-
|
| 1515 |
-
|
| 1516 |
You're a master of 'showing' and skilled with subtext.
|
| 1517 |
You're an expert at writing vivid, natural dialogue.
|
| 1518 |
You find creative solutions while considering production reality.""",
|
| 1519 |
-
|
| 1520 |
-
|
| 1521 |
You're a perfectionist who misses no small detail.
|
| 1522 |
You maximize the story's potential.
|
| 1523 |
You provide constructive and specific improvements.""",
|
| 1524 |
-
|
| 1525 |
-
|
| 1526 |
You see through the story's skeleton and muscles.
|
| 1527 |
You find logical gaps and emotional voids.
|
| 1528 |
You make specific suggestions for better structure.""",
|
| 1529 |
-
|
| 1530 |
-
|
| 1531 |
You evaluate commercial and artistic value in balance.
|
| 1532 |
You consider all perspectives: producers, actors, audience.
|
| 1533 |
You provide feedback that's critical yet encouraging."""
|
| 1534 |
-
|
| 1535 |
-
|
| 1536 |
-
|
| 1537 |
-
|
| 1538 |
|
| 1539 |
-
# --- Main process ---
|
| 1540 |
def process_screenplay_stream(self, query: str, screenplay_type: str, genre: str,
|
| 1541 |
language: str, session_id: Optional[str] = None
|
| 1542 |
) -> Generator[Tuple[str, List[Dict[str, Any]], str], None, None]:
|
|
@@ -1629,266 +1718,175 @@ You provide feedback that's critical yet encouraging."""
|
|
| 1629 |
logger.error(f"Screenplay generation error: {e}", exc_info=True)
|
| 1630 |
yield f"โ Error occurred: {e}", stages if 'stages' in locals() else [], self.current_session_id
|
| 1631 |
|
| 1632 |
-
|
| 1633 |
-
|
| 1634 |
def get_stage_prompt(self, stage_idx: int, role: str, query: str,
|
| 1635 |
-
|
| 1636 |
-
|
| 1637 |
-
|
| 1638 |
-
|
| 1639 |
-
|
| 1640 |
-
|
| 1641 |
-
|
| 1642 |
-
|
| 1643 |
-
|
| 1644 |
-
|
| 1645 |
-
|
| 1646 |
-
|
| 1647 |
-
|
| 1648 |
-
|
| 1649 |
-
|
| 1650 |
-
|
| 1651 |
-
|
| 1652 |
-
|
| 1653 |
-
|
| 1654 |
-
|
| 1655 |
-
|
| 1656 |
-
|
| 1657 |
-
|
| 1658 |
-
|
| 1659 |
-
|
| 1660 |
-
|
| 1661 |
-
|
| 1662 |
-
|
| 1663 |
-
|
| 1664 |
-
|
| 1665 |
-
|
| 1666 |
-
|
| 1667 |
-
|
| 1668 |
-
|
| 1669 |
-
|
| 1670 |
-
|
| 1671 |
-
|
| 1672 |
-
|
| 1673 |
-
|
| 1674 |
-
|
| 1675 |
-
|
| 1676 |
-
|
| 1677 |
-
|
| 1678 |
-
|
| 1679 |
-
|
| 1680 |
-
|
| 1681 |
-
|
| 1682 |
-
|
| 1683 |
-
|
| 1684 |
-
|
| 1685 |
-
|
| 1686 |
-
|
| 1687 |
-
|
| 1688 |
-
|
| 1689 |
-
def create_critic_structure_prompt(self, story_structure: str, characters: str,
|
| 1690 |
-
screenplay_type: str, genre: str, language: str) -> str:
|
| 1691 |
-
"""Structure critic prompt"""
|
| 1692 |
-
lang_prompts = {
|
| 1693 |
-
"Korean": f"""๋น์ ์ ๊ตฌ์กฐ ๋นํ๊ฐ์
๋๋ค. ์คํ ๋ฆฌ ๊ตฌ์กฐ์ ์บ๋ฆญํฐ ์ค์ ์ ์ฌ์ธต ๋ถ์ํ์ธ์.
|
| 1694 |
-
|
| 1695 |
-
**์คํ ๋ฆฌ ๊ตฌ์กฐ:**
|
| 1696 |
-
{story_structure}
|
| 1697 |
-
|
| 1698 |
-
**์บ๋ฆญํฐ ์ค์ :**
|
| 1699 |
-
{characters}
|
| 1700 |
-
|
| 1701 |
-
**๋ถ์ ํญ๋ชฉ:**
|
| 1702 |
-
|
| 1703 |
-
1. **3๋ง ๊ตฌ์กฐ ํจ๊ณผ์ฑ**
|
| 1704 |
-
- ๊ฐ ๋ง์ ๊ท ํ
|
| 1705 |
-
- ์ ํ์ ์ ๊ฐ๋
|
| 1706 |
-
- ํ๋กฏ ํฌ์ธํธ์ ๋ช
ํ์ฑ
|
| 1707 |
-
- ํด๋ผ์ด๋งฅ์ค ์์น
|
| 1708 |
-
|
| 1709 |
-
2. **์บ๋ฆญํฐ ์ํฌ ํ๋น์ฑ**
|
| 1710 |
-
- ๋ณํ์ ์ ๋น์ฑ
|
| 1711 |
-
- ๋๊ธฐ์ ๋ช
ํ์ฑ
|
| 1712 |
-
- ๋ด์ /์ธ์ ๋ชฉํ ์ผ์น
|
| 1713 |
-
- ๊ด๊ณ ์ญํ
|
| 1714 |
-
|
| 1715 |
-
3. **ํ
๋ง ํตํฉ**
|
| 1716 |
-
- ํ
๋ง์ ์ผ๊ด์ฑ
|
| 1717 |
-
- ํ๋กฏ๊ณผ ํ
๋ง ์ฐ๊ฒฐ
|
| 1718 |
-
- ์บ๋ฆญํฐ์ ํ
๋ง ์ฐ๊ฒฐ
|
| 1719 |
-
- ์๊ฐ์ ํ
๋ง ํํ
|
| 1720 |
-
|
| 1721 |
-
4. **์ฅ๋ฅด ๊ธฐ๋์น**
|
| 1722 |
-
- {genre} ๊ด์ต ์ถฉ์กฑ
|
| 1723 |
-
- ๋
์ฐฝ์ฑ๊ณผ ์น์ํจ ๊ท ํ
|
| 1724 |
-
- ํ๊ฒ ๊ด๊ฐ ๋ง์กฑ๋
|
| 1725 |
-
|
| 1726 |
-
5. **์ ์ ํ์ค์ฑ**
|
| 1727 |
-
- ์์ฐ ๊ท๋ชจ ์ ์ ์ฑ
|
| 1728 |
-
- ๋ก์ผ์ด์
์คํ ๊ฐ๋ฅ์ฑ
|
| 1729 |
-
- ํน์ํจ๊ณผ ์๊ตฌ์ฌํญ
|
| 1730 |
-
|
| 1731 |
-
**ํ์ ๊ฐ์ ์ ์:**
|
| 1732 |
-
๊ฐ ๋ฌธ์ ์ ์ ๋ํ ๊ตฌ์ฒด์ ํด๊ฒฐ์ฑ
์ ์ ์ํ์ธ์.""",
|
| 1733 |
-
|
| 1734 |
-
"English": f"""You are a structure critic. Deeply analyze story structure and character setup.
|
| 1735 |
-
|
| 1736 |
-
**Story Structure:**
|
| 1737 |
-
{story_structure}
|
| 1738 |
-
|
| 1739 |
-
**Character Setup:**
|
| 1740 |
-
{characters}
|
| 1741 |
-
|
| 1742 |
-
**Analysis Items:**
|
| 1743 |
-
|
| 1744 |
-
1. **Three-Act Structure Effectiveness**
|
| 1745 |
-
- Balance of each act
|
| 1746 |
-
- Strength of transitions
|
| 1747 |
-
- Clarity of plot points
|
| 1748 |
-
- Climax positioning
|
| 1749 |
-
|
| 1750 |
-
2. **Character Arc Validity**
|
| 1751 |
-
- Credibility of change
|
| 1752 |
-
- Clarity of motivation
|
| 1753 |
-
- Internal/external goal alignment
|
| 1754 |
-
- Relationship dynamics
|
| 1755 |
-
|
| 1756 |
-
3. **Theme Integration**
|
| 1757 |
-
- Theme consistency
|
| 1758 |
-
- Plot-theme connection
|
| 1759 |
-
- Character-theme connection
|
| 1760 |
-
- Visual theme expression
|
| 1761 |
-
|
| 1762 |
-
4. **Genre Expectations**
|
| 1763 |
-
- Meeting {genre} conventions
|
| 1764 |
-
- Balance of originality and familiarity
|
| 1765 |
-
- Target audience satisfaction
|
| 1766 |
-
|
| 1767 |
-
5. **Production Reality**
|
| 1768 |
-
- Budget scale appropriateness
|
| 1769 |
-
- Location feasibility
|
| 1770 |
-
- Special effects requirements
|
| 1771 |
-
|
| 1772 |
-
**Required Improvement Suggestions:**
|
| 1773 |
-
Provide specific solutions for each issue."""
|
| 1774 |
-
}
|
| 1775 |
-
|
| 1776 |
-
return lang_prompts.get(language, lang_prompts["English"])
|
| 1777 |
|
| 1778 |
def _get_previous_acts(self, stages: List[Dict], current_idx: int) -> str:
|
| 1779 |
-
|
| 1780 |
-
|
| 1781 |
-
|
| 1782 |
-
|
| 1783 |
-
|
| 1784 |
-
|
| 1785 |
-
|
| 1786 |
-
|
| 1787 |
-
|
| 1788 |
-
|
| 1789 |
|
| 1790 |
def _process_producer_content(self, content: str):
|
| 1791 |
-
|
| 1792 |
-
|
| 1793 |
-
|
| 1794 |
-
|
| 1795 |
-
|
| 1796 |
-
|
| 1797 |
-
|
| 1798 |
-
|
| 1799 |
-
|
| 1800 |
-
|
| 1801 |
-
|
| 1802 |
-
|
| 1803 |
-
|
| 1804 |
|
| 1805 |
def _process_story_content(self, content: str):
|
| 1806 |
-
|
| 1807 |
-
|
| 1808 |
-
|
| 1809 |
-
|
| 1810 |
-
|
| 1811 |
-
|
| 1812 |
-
|
| 1813 |
-
|
| 1814 |
-
|
| 1815 |
-
|
| 1816 |
-
|
| 1817 |
|
| 1818 |
def _process_character_content(self, content: str):
|
| 1819 |
-
|
| 1820 |
-
|
| 1821 |
-
|
| 1822 |
-
|
| 1823 |
-
|
| 1824 |
-
|
| 1825 |
-
|
| 1826 |
-
|
| 1827 |
-
|
| 1828 |
-
|
| 1829 |
-
|
| 1830 |
-
|
| 1831 |
-
|
| 1832 |
-
|
| 1833 |
|
| 1834 |
def _process_scene_content(self, content: str):
|
| 1835 |
-
|
| 1836 |
-
|
| 1837 |
-
|
| 1838 |
-
|
| 1839 |
-
|
| 1840 |
-
|
| 1841 |
-
|
| 1842 |
-
|
| 1843 |
-
|
| 1844 |
-
|
| 1845 |
-
|
| 1846 |
-
|
| 1847 |
-
|
| 1848 |
-
|
| 1849 |
-
|
| 1850 |
-
|
| 1851 |
-
|
| 1852 |
-
|
| 1853 |
-
|
| 1854 |
-
|
| 1855 |
-
|
| 1856 |
-
|
| 1857 |
-
|
| 1858 |
-
|
| 1859 |
-
|
| 1860 |
-
|
| 1861 |
|
| 1862 |
def _extract_section(self, content: str, section_pattern: str) -> str:
|
| 1863 |
-
|
| 1864 |
-
|
| 1865 |
-
|
| 1866 |
-
|
| 1867 |
|
| 1868 |
def _parse_character_profile(self, content: str, role: str) -> CharacterProfile:
|
| 1869 |
-
|
| 1870 |
-
|
| 1871 |
-
|
| 1872 |
-
|
| 1873 |
-
|
| 1874 |
-
|
| 1875 |
-
|
| 1876 |
-
|
| 1877 |
-
|
| 1878 |
-
|
| 1879 |
-
|
| 1880 |
-
|
| 1881 |
-
|
| 1882 |
-
|
| 1883 |
-
|
| 1884 |
-
|
| 1885 |
-
|
| 1886 |
|
| 1887 |
def _extract_field(self, content: str, field_pattern: str) -> Optional[str]:
|
| 1888 |
-
|
| 1889 |
-
|
| 1890 |
-
|
| 1891 |
-
|
| 1892 |
|
| 1893 |
# --- Utility functions ---
|
| 1894 |
def generate_random_screenplay_theme(screenplay_type: str, genre: str, language: str) -> str:
|
|
|
|
| 589 |
return "\n".join(extracted)
|
| 590 |
|
| 591 |
class ScreenplayGenerationSystem:
|
| 592 |
+
"""Professional screenplay generation system"""
|
| 593 |
+
def __init__(self):
|
| 594 |
+
self.token = FRIENDLI_TOKEN
|
| 595 |
+
self.api_url = API_URL
|
| 596 |
+
self.model_id = MODEL_ID
|
| 597 |
+
self.screenplay_tracker = ScreenplayTracker()
|
| 598 |
+
self.web_search = WebSearchIntegration()
|
| 599 |
+
self.current_session_id = None
|
| 600 |
+
ScreenplayDatabase.init_db()
|
| 601 |
+
|
| 602 |
+
def create_headers(self):
|
| 603 |
+
return {"Authorization": f"Bearer {self.token}", "Content-Type": "application/json"}
|
| 604 |
+
|
| 605 |
+
# --- Prompt generation functions ---
|
| 606 |
+
def create_producer_prompt(self, user_query: str, screenplay_type: str,
|
| 607 |
+
genre: str, language: str) -> str:
|
| 608 |
+
"""Producer initial concept development"""
|
| 609 |
+
|
| 610 |
+
# Web search for market trends if enabled
|
| 611 |
+
search_results = ""
|
| 612 |
+
if self.web_search.enabled:
|
| 613 |
+
queries = [
|
| 614 |
+
f"box office success {genre} films 2024 2025",
|
| 615 |
+
f"popular {screenplay_type} {genre} trends",
|
| 616 |
+
f"audience demographics {genre} movies"
|
| 617 |
+
]
|
| 618 |
+
for q in queries[:2]:
|
| 619 |
+
results = self.web_search.search(q, count=2, language=language)
|
| 620 |
+
if results:
|
| 621 |
+
search_results += self.web_search.extract_relevant_info(results) + "\n"
|
| 622 |
+
|
| 623 |
+
lang_prompts = {
|
| 624 |
+
"Korean": f"""๋น์ ์ ํ ๋ฆฌ์ฐ๋ ํ๋ก๋์์
๋๋ค. ์์
์ ์ผ๋ก ์ฑ๊ณต ๊ฐ๋ฅํ {screenplay_type} ์ปจ์
์ ๊ฐ๋ฐํ์ธ์.
|
| 625 |
|
| 626 |
**์์ฒญ์ฌํญ:** {user_query}
|
| 627 |
**ํ์
:** {SCREENPLAY_LENGTHS[screenplay_type]['description']}
|
|
|
|
| 633 |
**ํ์ ์ ๊ณต ํญ๋ชฉ:**
|
| 634 |
|
| 635 |
1. **์ ๋ชฉ (TITLE)**
|
| 636 |
+
- ๊ธฐ์ตํ๊ธฐ ์ฝ๊ณ ๋ง์ผํ
๊ฐ๋ฅํ ์ ๋ชฉ
|
| 637 |
+
- ์ฅ๋ฅด์ ํค์ ์์ํ๋ ์ ๋ชฉ
|
| 638 |
|
| 639 |
2. **๋ก๊ทธ๋ผ์ธ (LOGLINE)**
|
| 640 |
+
- 25๋จ์ด ์ด๋ด ํ ๋ฌธ์ฅ
|
| 641 |
+
- ํ์: "[์ฌ๊ฑด]์ด ์ผ์ด๋ฌ์ ๋, [์ฃผ์ธ๊ณต]์ [๋ชฉํ]๋ฅผ ์ด๋ฃจ์ด์ผ ํ๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด [๊ฒฐ๊ณผ]"
|
| 642 |
+
- ๊ฐ๋ฑ๊ณผ stakes๊ฐ ๋ช
ํํด์ผ ํจ
|
| 643 |
|
| 644 |
3. **์ฅ๋ฅด ๋ถ์**
|
| 645 |
+
- ์ฃผ ์ฅ๋ฅด: {genre}
|
| 646 |
+
- ์๋ธ ์ฅ๋ฅด:
|
| 647 |
+
- ํค & ๋ถ์๊ธฐ:
|
| 648 |
|
| 649 |
4. **ํ๊ฒ ๊ด๊ฐ**
|
| 650 |
+
- ์ฃผ์ ์ฐ๋ น๋:
|
| 651 |
+
- ์ฑ๋ณ ๋ถํฌ:
|
| 652 |
+
- ๊ด์ฌ์ฌ:
|
| 653 |
+
- ์ ์ฌ ์ํ ํฌ์ธต:
|
| 654 |
|
| 655 |
5. **๋น๊ต ์ํ (COMPS)**
|
| 656 |
+
- 3๊ฐ์ ์ฑ๊ณตํ ์ ์ฌ ํ๋ก์ ํธ
|
| 657 |
+
- ๊ฐ๊ฐ์ ๋ฐ์ค์คํผ์ค/์์ฒญ๋ฅ ์ฑ๊ณผ
|
| 658 |
+
- ์ฐ๋ฆฌ ํ๋ก์ ํธ์์ ์ฐจ๋ณ์
|
| 659 |
|
| 660 |
6. **๊ณ ์ ํ๋งค ํฌ์ธํธ (USP)**
|
| 661 |
+
- ์ด ์ด์ผ๊ธฐ๋ง์ ๋
ํนํ ์
|
| 662 |
+
- ํ์ฌ ์์ฅ์์์ ํ์์ฑ
|
| 663 |
+
- ์ ์ ๊ฐ๋ฅ์ฑ
|
| 664 |
|
| 665 |
7. **๋น์ฃผ์ผ ์ปจ์
**
|
| 666 |
+
- ํต์ฌ ๋น์ฃผ์ผ ์ด๋ฏธ์ง 3๊ฐ
|
| 667 |
+
- ์ ์ฒด์ ์ธ ๋ฃฉ & ํ
|
| 668 |
|
| 669 |
๊ตฌ์ฒด์ ์ด๊ณ ์์ฅ์ฑ ์๋ ์ปจ์
์ ์ ์ํ์ธ์.""",
|
| 670 |
|
| 671 |
+
"English": f"""You are a Hollywood producer. Develop a commercially viable {screenplay_type} concept.
|
| 672 |
|
| 673 |
**Request:** {user_query}
|
| 674 |
**Type:** {SCREENPLAY_LENGTHS[screenplay_type]['description']}
|
|
|
|
| 680 |
**Required Elements:**
|
| 681 |
|
| 682 |
1. **TITLE**
|
| 683 |
+
- Memorable and marketable
|
| 684 |
+
- Hints at genre and tone
|
| 685 |
|
| 686 |
2. **LOGLINE**
|
| 687 |
+
- One sentence, 25 words max
|
| 688 |
+
- Format: "When [inciting incident], a [protagonist] must [objective] or else [stakes]"
|
| 689 |
+
- Clear conflict and stakes
|
| 690 |
|
| 691 |
3. **GENRE ANALYSIS**
|
| 692 |
+
- Primary Genre: {genre}
|
| 693 |
+
- Sub-genre:
|
| 694 |
+
- Tone & Mood:
|
| 695 |
|
| 696 |
4. **TARGET AUDIENCE**
|
| 697 |
+
- Primary Age Range:
|
| 698 |
+
- Gender Distribution:
|
| 699 |
+
- Interests:
|
| 700 |
+
- Similar Works Fanbase:
|
| 701 |
|
| 702 |
5. **COMPARABLE FILMS (COMPS)**
|
| 703 |
+
- 3 successful similar projects
|
| 704 |
+
- Box office/viewership performance
|
| 705 |
+
- How ours differs
|
| 706 |
|
| 707 |
6. **UNIQUE SELLING POINT (USP)**
|
| 708 |
+
- What makes this story unique
|
| 709 |
+
- Why now in the market
|
| 710 |
+
- Production feasibility
|
| 711 |
|
| 712 |
7. **VISUAL CONCEPT**
|
| 713 |
+
- 3 key visual images
|
| 714 |
+
- Overall look & feel
|
| 715 |
|
| 716 |
Provide specific, marketable concept."""
|
| 717 |
+
}
|
| 718 |
+
|
| 719 |
+
return lang_prompts.get(language, lang_prompts["English"])
|
| 720 |
|
| 721 |
+
def create_story_developer_prompt(self, producer_concept: str, user_query: str,
|
| 722 |
+
screenplay_type: str, genre: str, language: str) -> str:
|
| 723 |
+
"""Story developer for synopsis and structure"""
|
| 724 |
+
|
| 725 |
+
genre_template = GENRE_TEMPLATES.get(genre, GENRE_TEMPLATES["drama"])
|
| 726 |
+
|
| 727 |
+
lang_prompts = {
|
| 728 |
+
"Korean": f"""๋น์ ์ ์คํ ๋ฆฌ ๊ฐ๋ฐ์์
๋๋ค. ํ๋ก๋์์ ์ปจ์
์ ๋ฐํ์ผ๋ก {screenplay_type}์ ์๋์์ค์ 3๋ง ๊ตฌ์กฐ๋ฅผ ๊ฐ๋ฐํ์ธ์.
|
| 729 |
|
| 730 |
**ํ๋ก๋์ ์ปจ์
:**
|
| 731 |
{producer_concept}
|
|
|
|
| 738 |
**ํ์ ์์ฑ ํญ๋ชฉ:**
|
| 739 |
|
| 740 |
1. **์๋์์ค (SYNOPSIS)**
|
| 741 |
+
- 300-500๋จ์ด
|
| 742 |
+
- 3๋ง ๊ตฌ์กฐ๊ฐ ๋ช
ํํ ๋๋ฌ๋๋๋ก
|
| 743 |
+
- ์ฃผ์ธ๊ณต์ ๋ณํ arc ํฌํจ
|
| 744 |
+
- ์ฃผ์ ์ ํ์ ๋ช
์
|
| 745 |
+
- ๊ฒฐ๋ง ํฌํจ (์คํฌ์ผ๋ฌ OK)
|
| 746 |
|
| 747 |
2. **3๋ง ๊ตฌ์กฐ (THREE-ACT STRUCTURE)**
|
| 748 |
+
|
| 749 |
+
**์ 1๋ง - ์ค์ (Setup) [25%]**
|
| 750 |
+
- ์ผ์ ์ธ๊ณ (Ordinary World):
|
| 751 |
+
- ๊ทผ์น์๊ฐ ์ฌ๊ฑด (Inciting Incident):
|
| 752 |
+
- ์ฃผ์ธ๊ณต ์๊ฐ ๋ฐ ๊ฒฐํจ:
|
| 753 |
+
- 1๋ง ์ ํ์ (Plot Point 1):
|
| 754 |
+
|
| 755 |
+
**์ 2๋งA - ์์น ์ก์
(Rising Action) [25%]**
|
| 756 |
+
- ์๋ก์ด ์ธ๊ณ ์ง์
:
|
| 757 |
+
- ์ฌ๋ฏธ์ ๊ฒ์ (Fun and Games):
|
| 758 |
+
- B ์คํ ๋ฆฌ (๊ด๊ณ/ํ
๋ง):
|
| 759 |
+
- ์ค๊ฐ์ (Midpoint) - ๊ฐ์ง ์น๋ฆฌ/ํจ๋ฐฐ:
|
| 760 |
+
|
| 761 |
+
**์ 2๋งB - ๋ณต์กํ (Complications) [25%]**
|
| 762 |
+
- ์
๋น์ ๋ฐ๊ฒฉ:
|
| 763 |
+
- ํ ํด์ฒด/์๊ธฐ:
|
| 764 |
+
- ๋ชจ๋ ๊ฒ์ ์์ (All Is Lost):
|
| 765 |
+
- ์ํผ์ ์ด๋ ๋ฐค:
|
| 766 |
+
|
| 767 |
+
**์ 3๋ง - ํด๊ฒฐ (Resolution) [25%]**
|
| 768 |
+
- 2๋ง ์ ํ์ (Plot Point 2):
|
| 769 |
+
- ์ต์ข
์ ํฌ ์ค๋น:
|
| 770 |
+
- ํด๋ผ์ด๋งฅ์ค:
|
| 771 |
+
- ์๋ก์ด ์ผ์:
|
| 772 |
|
| 773 |
3. **Save the Cat ๋นํธ ์ํธ**
|
| 774 |
+
15๊ฐ ๋นํธ๋ฅผ {SCREENPLAY_LENGTHS[screenplay_type]['pages']}ํ์ด์ง์ ๋ง์ถฐ ๋ฐฐ์น
|
| 775 |
|
| 776 |
4. **์ฃผ์ (THEME)**
|
| 777 |
+
- ์ค์ฌ ์ฃผ์ :
|
| 778 |
+
- ์ฃผ์ ๊ฐ ๋๋ฌ๋๋ ์๊ฐ:
|
| 779 |
+
- ์ฃผ์ ์ ์๊ฐ์ ํํ:
|
| 780 |
|
| 781 |
5. **ํค & ์คํ์ผ**
|
| 782 |
+
- ์ ์ฒด์ ์ธ ํค:
|
| 783 |
+
- ์ ๋จธ ์ฌ์ฉ ์ฌ๋ถ:
|
| 784 |
+
- ๋น์ฃผ์ผ ์คํ์ผ:
|
| 785 |
|
| 786 |
๊ตฌ์ฒด์ ์ด๊ณ ๊ฐ์ ์ ์ผ๋ก ๊ณต๊ฐ๊ฐ๋ ์คํ ๋ฆฌ๋ฅผ ๋ง๋์ธ์.""",
|
| 787 |
|
| 788 |
+
"English": f"""You are a story developer. Based on the producer's concept, develop the synopsis and three-act structure for this {screenplay_type}.
|
| 789 |
|
| 790 |
**Producer Concept:**
|
| 791 |
{producer_concept}
|
|
|
|
| 798 |
**Required Elements:**
|
| 799 |
|
| 800 |
1. **SYNOPSIS**
|
| 801 |
+
- 300-500 words
|
| 802 |
+
- Clear three-act structure
|
| 803 |
+
- Protagonist's change arc
|
| 804 |
+
- Major turning points
|
| 805 |
+
- Include ending (spoilers OK)
|
| 806 |
|
| 807 |
2. **THREE-ACT STRUCTURE**
|
| 808 |
+
|
| 809 |
+
**ACT 1 - Setup [25%]**
|
| 810 |
+
- Ordinary World:
|
| 811 |
+
- Inciting Incident:
|
| 812 |
+
- Protagonist Introduction & Flaw:
|
| 813 |
+
- Plot Point 1:
|
| 814 |
+
|
| 815 |
+
**ACT 2A - Rising Action [25%]**
|
| 816 |
+
- Entering New World:
|
| 817 |
+
- Fun and Games:
|
| 818 |
+
- B Story (Relationship/Theme):
|
| 819 |
+
- Midpoint - False Victory/Defeat:
|
| 820 |
+
|
| 821 |
+
**ACT 2B - Complications [25%]**
|
| 822 |
+
- Bad Guys Close In:
|
| 823 |
+
- Team Breaks Down/Crisis:
|
| 824 |
+
- All Is Lost:
|
| 825 |
+
- Dark Night of the Soul:
|
| 826 |
+
|
| 827 |
+
**ACT 3 - Resolution [25%]**
|
| 828 |
+
- Plot Point 2:
|
| 829 |
+
- Final Battle Preparation:
|
| 830 |
+
- Climax:
|
| 831 |
+
- New Normal:
|
| 832 |
|
| 833 |
3. **SAVE THE CAT BEAT SHEET**
|
| 834 |
+
Place 15 beats across {SCREENPLAY_LENGTHS[screenplay_type]['pages']} pages
|
| 835 |
|
| 836 |
4. **THEME**
|
| 837 |
+
- Central Theme:
|
| 838 |
+
- Theme Stated Moment:
|
| 839 |
+
- Visual Theme Expression:
|
| 840 |
|
| 841 |
5. **TONE & STYLE**
|
| 842 |
+
- Overall Tone:
|
| 843 |
+
- Use of Humor:
|
| 844 |
+
- Visual Style:
|
| 845 |
|
| 846 |
Create specific, emotionally resonant story."""
|
| 847 |
+
}
|
| 848 |
+
|
| 849 |
+
return lang_prompts.get(language, lang_prompts["English"])
|
| 850 |
|
| 851 |
+
def create_character_designer_prompt(self, producer_concept: str, story_structure: str,
|
| 852 |
+
genre: str, language: str) -> str:
|
| 853 |
+
"""Character designer prompt"""
|
| 854 |
+
|
| 855 |
+
lang_prompts = {
|
| 856 |
+
"Korean": f"""๋น์ ์ ์บ๋ฆญํฐ ๋์์ด๋์
๋๋ค. ๋ค์ธต์ ์ด๊ณ ๋งค๋ ฅ์ ์ธ ์บ๋ฆญํฐ๋ค์ ์ฐฝ์กฐํ์ธ์.
|
| 857 |
|
| 858 |
**ํ๋ก๋์ ์ปจ์
:**
|
| 859 |
{producer_concept}
|
|
|
|
| 864 |
**ํ์ ์บ๋ฆญํฐ ํ๋กํ:**
|
| 865 |
|
| 866 |
1. **์ฃผ์ธ๊ณต (PROTAGONIST)**
|
| 867 |
+
- ์ด๋ฆ & ๋์ด:
|
| 868 |
+
- ์ง์
/์ญํ :
|
| 869 |
+
- ์บ๋ฆญํฐ ์ํฌํ์
:
|
| 870 |
+
- WANT (์ธ์ ๋ชฉํ):
|
| 871 |
+
- NEED (๋ด์ ํ์):
|
| 872 |
+
- ์น๋ช
์ ๊ฒฐํจ (Fatal Flaw):
|
| 873 |
+
- ๋ฐฑ์คํ ๋ฆฌ (ํต์ฌ ์์ฒ):
|
| 874 |
+
- ์ฑ๊ฒฉ ํน์ฑ (3-5๊ฐ):
|
| 875 |
+
- ๋งํฌ & ์ธ์ด ํจํด:
|
| 876 |
+
- ์๊ฐ์ ํน์ง:
|
| 877 |
+
- ์บ๋ฆญํฐ ์ํฌ (AโB):
|
| 878 |
|
| 879 |
2. **์ ๋์ (ANTAGONIST)**
|
| 880 |
+
- ์ด๋ฆ & ๋์ด:
|
| 881 |
+
- ์ง์
/์ญํ :
|
| 882 |
+
- ์
์ญ ์ํฌํ์
:
|
| 883 |
+
- ๋ชฉํ & ๋๊ธฐ:
|
| 884 |
+
- ์ฃผ์ธ๊ณต๊ณผ์ ์ฐ๊ฒฐ์ :
|
| 885 |
+
- ์ ๋น์ฑ ์๋ ์ด์ :
|
| 886 |
+
- ์ฝ์ :
|
| 887 |
+
- ํน์ง์ ํ๋:
|
| 888 |
|
| 889 |
3. **์กฐ๋ ฅ์๋ค (SUPPORTING CAST)**
|
| 890 |
+
์ต์ 3๋ช
, ๊ฐ๊ฐ:
|
| 891 |
+
- ์ด๋ฆ & ์ญํ :
|
| 892 |
+
- ์ฃผ์ธ๊ณต๊ณผ์ ๊ด๊ณ:
|
| 893 |
+
- ์คํ ๋ฆฌ ๊ธฐ๋ฅ:
|
| 894 |
+
- ๋
ํนํ ํน์ฑ:
|
| 895 |
+
- ๊ธฐ์ฌํ๋ ๋ฐ:
|
| 896 |
|
| 897 |
4. **์บ๋ฆญํฐ ๊ด๊ณ๋**
|
| 898 |
+
- ์ฃผ์ ๊ด๊ณ ์ญํ:
|
| 899 |
+
- ๊ฐ๋ฑ ๊ตฌ์กฐ:
|
| 900 |
+
- ๊ฐ์ ์ ์ฐ๊ฒฐ:
|
| 901 |
+
- ํ์ ๋ค์ด๋๋ฏน:
|
| 902 |
|
| 903 |
5. **์บ์คํ
์ ์**
|
| 904 |
+
- ๊ฐ ์ฃผ์ ์บ๋ฆญํฐ๋ณ ์ด์์ ์ธ ๋ฐฐ์ฐ ํ์
|
| 905 |
+
- ์ฐ๋ น๋, ์ธ๋ชจ, ์ฐ๊ธฐ ์คํ์ผ
|
| 906 |
|
| 907 |
6. **๋ํ ์ํ**
|
| 908 |
+
- ๊ฐ ์ฃผ์ ์บ๋ฆญํฐ์ ์๊ทธ๋์ฒ ๋์ฌ 2-3๊ฐ
|
| 909 |
+
- ์บ๋ฆญํฐ์ ๋ณธ์ง์ ๋๋ฌ๋ด๋ ๋ํ
|
| 910 |
|
| 911 |
๊ฐ ์บ๋ฆญํฐ๊ฐ ํ
๋ง๋ฅผ ๊ตฌํํ๊ณ ์คํ ๋ฆฌ๋ฅผ ์ถ์งํ๋๋ก ๋์์ธํ์ธ์.""",
|
| 912 |
|
| 913 |
+
"English": f"""You are a character designer. Create multi-dimensional, compelling characters.
|
| 914 |
|
| 915 |
**Producer Concept:**
|
| 916 |
{producer_concept}
|
|
|
|
| 921 |
**Required Character Profiles:**
|
| 922 |
|
| 923 |
1. **PROTAGONIST**
|
| 924 |
+
- Name & Age:
|
| 925 |
+
- Occupation/Role:
|
| 926 |
+
- Character Archetype:
|
| 927 |
+
- WANT (External Goal):
|
| 928 |
+
- NEED (Internal Need):
|
| 929 |
+
- Fatal Flaw:
|
| 930 |
+
- Backstory (Core Wound):
|
| 931 |
+
- Personality Traits (3-5):
|
| 932 |
+
- Speech Pattern:
|
| 933 |
+
- Visual Characteristics:
|
| 934 |
+
- Character Arc (AโB):
|
| 935 |
|
| 936 |
2. **ANTAGONIST**
|
| 937 |
+
- Name & Age:
|
| 938 |
+
- Occupation/Role:
|
| 939 |
+
- Villain Archetype:
|
| 940 |
+
- Goal & Motivation:
|
| 941 |
+
- Connection to Protagonist:
|
| 942 |
+
- Justifiable Reason:
|
| 943 |
+
- Weakness:
|
| 944 |
+
- Signature Behaviors:
|
| 945 |
|
| 946 |
3. **SUPPORTING CAST**
|
| 947 |
+
Minimum 3, each with:
|
| 948 |
+
- Name & Role:
|
| 949 |
+
- Relationship to Protagonist:
|
| 950 |
+
- Story Function:
|
| 951 |
+
- Unique Traits:
|
| 952 |
+
- What They Contribute:
|
| 953 |
|
| 954 |
4. **CHARACTER RELATIONSHIPS**
|
| 955 |
+
- Key Relationship Dynamics:
|
| 956 |
+
- Conflict Structure:
|
| 957 |
+
- Emotional Connections:
|
| 958 |
+
- Power Dynamics:
|
| 959 |
|
| 960 |
5. **CASTING SUGGESTIONS**
|
| 961 |
+
- Ideal actor type for each major character
|
| 962 |
+
- Age range, appearance, acting style
|
| 963 |
|
| 964 |
6. **DIALOGUE SAMPLES**
|
| 965 |
+
- 2-3 signature lines per major character
|
| 966 |
+
- Dialogue revealing character essence
|
| 967 |
|
| 968 |
Design each character to embody theme and drive story."""
|
| 969 |
+
}
|
| 970 |
+
|
| 971 |
+
return lang_prompts.get(language, lang_prompts["English"])
|
| 972 |
|
| 973 |
+
def create_scene_planner_prompt(self, story_structure: str, characters: str,
|
| 974 |
+
screenplay_type: str, genre: str, language: str) -> str:
|
| 975 |
+
"""Scene breakdown planner"""
|
| 976 |
+
|
| 977 |
+
total_pages = SCREENPLAY_LENGTHS[screenplay_type]['pages']
|
| 978 |
+
|
| 979 |
+
lang_prompts = {
|
| 980 |
+
"Korean": f"""๋น์ ์ ์ฌ ํ๋๋์
๋๋ค. {total_pages}ํ์ด์ง {screenplay_type}์ ์์ธํ ์ฌ ๋ธ๋ ์ดํฌ๋ค์ด์ ์์ฑํ์ธ์.
|
| 981 |
|
| 982 |
**์คํ ๋ฆฌ ๊ตฌ์กฐ:**
|
| 983 |
{story_structure}
|
|
|
|
| 1015 |
|
| 1016 |
๊ฐ ์ฌ์ด ์คํ ๋ฆฌ๋ฅผ ์ ์ง์ํค๊ณ ์บ๋ฆญํฐ๋ฅผ ๋ฐ์ ์ํค๋๋ก ๊ณํํ์ธ์.""",
|
| 1017 |
|
| 1018 |
+
"English": f"""You are a scene planner. Create detailed scene breakdown for {total_pages}-page {screenplay_type}.
|
| 1019 |
|
| 1020 |
**Story Structure:**
|
| 1021 |
{story_structure}
|
|
|
|
| 1052 |
- DISSOLVE TO:
|
| 1053 |
|
| 1054 |
Plan each scene to advance story and develop character."""
|
| 1055 |
+
}
|
| 1056 |
+
|
| 1057 |
+
return lang_prompts.get(language, lang_prompts["English"])
|
| 1058 |
|
| 1059 |
+
def create_screenwriter_prompt(self, act: str, scene_breakdown: str,
|
| 1060 |
+
characters: str, previous_acts: str,
|
| 1061 |
+
screenplay_type: str, genre: str, language: str) -> str:
|
| 1062 |
+
"""Screenwriter prompt for actual screenplay pages"""
|
| 1063 |
+
|
| 1064 |
+
act_pages = int(SCREENPLAY_LENGTHS[screenplay_type]['pages'] * 0.25)
|
| 1065 |
+
|
| 1066 |
+
lang_prompts = {
|
| 1067 |
+
"Korean": f"""๋น์ ์ ํ๋ก ์๋๋ฆฌ์ค ์๊ฐ์
๋๋ค. {act}์ ํ์ค ์๋๋ฆฌ์ค ํฌ๋งท์ผ๋ก ์์ฑํ์ธ์.
|
| 1068 |
|
| 1069 |
**ํ๊ฒ ๋ถ๋:** {act_pages}ํ์ด์ง
|
| 1070 |
|
|
|
|
| 1080 |
**์๋๋ฆฌ์ค ํฌ๋งท ๊ท์น:**
|
| 1081 |
|
| 1082 |
1. **์ฌ ํค๋ฉ**
|
| 1083 |
+
INT. ์ฅ์ - ์๊ฐ
|
| 1084 |
+
EXT. ์ฅ์ - ์๊ฐ
|
| 1085 |
|
| 1086 |
2. **์ก์
๋ผ์ธ**
|
| 1087 |
+
- ํ์ฌ ์์ ์ฌ์ฉ
|
| 1088 |
+
- ์๊ฐ์ ์ผ๋ก ๋ณด์ด๋ ๊ฒ๋ง ๋ฌ์ฌ
|
| 1089 |
+
- 4์ค ์ดํ๋ก ์ ์ง
|
| 1090 |
+
- ๊ฐ์ ์ ํ๋์ผ๋ก ํํ
|
| 1091 |
|
| 1092 |
3. **์บ๋ฆญํฐ ์๊ฐ**
|
| 1093 |
+
์ฒซ ๋ฑ์ฅ์: ์ด๋ฆ (๋์ด) ๊ฐ๋จํ ๋ฌ์ฌ
|
| 1094 |
|
| 1095 |
4. **๋ํ**
|
| 1096 |
+
์บ๋ฆญํฐ๋ช
|
| 1097 |
+
(์ง๋ฌธ)
|
| 1098 |
+
๋์ฌ
|
| 1099 |
|
| 1100 |
5. **์ค์ ์์น**
|
| 1101 |
+
- Show, don't tell
|
| 1102 |
+
- ์๋ธํ
์คํธ ํ์ฉ
|
| 1103 |
+
- ์์ฐ์ค๋ฌ์ด ๋ํ
|
| 1104 |
+
- ์๊ฐ์ ์คํ ๋ฆฌํ
๋ง
|
| 1105 |
+
- ํ์ด์ง๋น 1๋ถ ๊ท์น
|
| 1106 |
|
| 1107 |
**{genre} ์ฅ๋ฅด ํน์ฑ:**
|
| 1108 |
- ๋ํ ๋น์จ: {GENRE_TEMPLATES[genre]['dialogue_ratio']*100}%
|
|
|
|
| 1111 |
|
| 1112 |
์ ํํ ํฌ๋งท๊ณผ ๋ชฐ์
๊ฐ ์๋ ์คํ ๋ฆฌํ
๋ง์ผ๋ก ์์ฑํ์ธ์.""",
|
| 1113 |
|
| 1114 |
+
"English": f"""You are a professional screenwriter. Write {act} in standard screenplay format.
|
| 1115 |
|
| 1116 |
**Target Length:** {act_pages} pages
|
| 1117 |
|
|
|
|
| 1127 |
**Screenplay Format Rules:**
|
| 1128 |
|
| 1129 |
1. **Scene Headings**
|
| 1130 |
+
INT. LOCATION - TIME
|
| 1131 |
+
EXT. LOCATION - TIME
|
| 1132 |
|
| 1133 |
2. **Action Lines**
|
| 1134 |
+
- Present tense
|
| 1135 |
+
- Only what's visually seen
|
| 1136 |
+
- Keep under 4 lines
|
| 1137 |
+
- Emotions through actions
|
| 1138 |
|
| 1139 |
3. **Character Intros**
|
| 1140 |
+
First appearance: NAME (age) brief description
|
| 1141 |
|
| 1142 |
4. **Dialogue**
|
| 1143 |
+
CHARACTER NAME
|
| 1144 |
+
(parenthetical)
|
| 1145 |
+
Dialogue
|
| 1146 |
|
| 1147 |
5. **Key Principles**
|
| 1148 |
+
- Show, don't tell
|
| 1149 |
+
- Use subtext
|
| 1150 |
+
- Natural dialogue
|
| 1151 |
+
- Visual storytelling
|
| 1152 |
+
- One page = one minute
|
| 1153 |
|
| 1154 |
**{genre} Genre Characteristics:**
|
| 1155 |
- Dialogue Ratio: {GENRE_TEMPLATES[genre]['dialogue_ratio']*100}%
|
|
|
|
| 1157 |
- Key Elements: {', '.join(GENRE_TEMPLATES[genre]['key_elements'][:2])}
|
| 1158 |
|
| 1159 |
Write with proper format and engaging storytelling."""
|
| 1160 |
+
}
|
| 1161 |
+
|
| 1162 |
+
return lang_prompts.get(language, lang_prompts["English"])
|
| 1163 |
|
| 1164 |
+
def create_script_doctor_prompt(self, act_content: str, act: str,
|
| 1165 |
+
genre: str, language: str) -> str:
|
| 1166 |
+
"""Script doctor review and polish"""
|
| 1167 |
+
|
| 1168 |
+
lang_prompts = {
|
| 1169 |
+
"Korean": f"""๋น์ ์ ์คํฌ๋ฆฝํธ ๋ฅํฐ์
๋๋ค. {act}๋ฅผ ๊ฒํ ํ๊ณ ๊ฐ์ ์ฌํญ์ ์ ์ํ์ธ์.
|
| 1170 |
|
| 1171 |
**์์ฑ๋ ๋ด์ฉ:**
|
| 1172 |
{act_content}
|
|
|
|
| 1174 |
**๊ฒํ ํญ๋ชฉ:**
|
| 1175 |
|
| 1176 |
1. **ํฌ๋งท ์ ํ์ฑ**
|
| 1177 |
+
- ์ฌ ํค๋ฉ ํ์
|
| 1178 |
+
- ์ก์
๋ผ์ธ ๊ธธ์ด
|
| 1179 |
+
- ๋ํ ํฌ๋งท
|
| 1180 |
+
- ์ ํ ํ์
|
| 1181 |
|
| 1182 |
2. **์คํ ๋ฆฌํ
๋ง**
|
| 1183 |
+
- ์๊ฐ์ ๋ช
ํ์ฑ
|
| 1184 |
+
- ํ์ด์ฑ
|
| 1185 |
+
- ๊ธด์ฅ๊ฐ ๊ตฌ์ถ
|
| 1186 |
+
- ์ฌ ๋ชฉ์ ๋ฌ์ฑ
|
| 1187 |
|
| 1188 |
3. **๋ํ ํ์ง**
|
| 1189 |
+
- ์์ฐ์ค๋ฌ์
|
| 1190 |
+
- ์บ๋ฆญํฐ ๊ณ ์ ์ฑ
|
| 1191 |
+
- ์๋ธํ
์คํธ
|
| 1192 |
+
- ๋ถํ์ํ ์ค๋ช
์ ๊ฑฐ
|
| 1193 |
|
| 1194 |
4. **{genre} ์ฅ๋ฅด ์ ํฉ์ฑ**
|
| 1195 |
+
- ์ฅ๋ฅด ๊ด์ต ์ค์
|
| 1196 |
+
- ํค ์ผ๊ด์ฑ
|
| 1197 |
+
- ๊ธฐ๋ ์ถฉ์กฑ
|
| 1198 |
|
| 1199 |
5. **๊ธฐ์ ์ ์ธก๋ฉด**
|
| 1200 |
+
- ํ์ด์ง ์ ์ ์ ์ฑ
|
| 1201 |
+
- ์ ์ ๊ฐ๋ฅ์ฑ
|
| 1202 |
+
- ์์ฐ ๊ณ ๋ ค์ฌํญ
|
| 1203 |
|
| 1204 |
**ํ์ ๊ฐ์ ์ฌํญ:**
|
| 1205 |
๊ตฌ์ฒด์ ์ธ ์์ ์ ์๊ณผ ๊ฐ์ ๋ ์์๋ฅผ ์ ๊ณตํ์ธ์.""",
|
| 1206 |
|
| 1207 |
+
"English": f"""You are a script doctor. Review and provide improvements for {act}.
|
| 1208 |
|
| 1209 |
**Written Content:**
|
| 1210 |
{act_content}
|
|
|
|
| 1212 |
**Review Areas:**
|
| 1213 |
|
| 1214 |
1. **Format Accuracy**
|
| 1215 |
+
- Scene heading format
|
| 1216 |
+
- Action line length
|
| 1217 |
+
- Dialogue format
|
| 1218 |
+
- Transitions
|
| 1219 |
|
| 1220 |
2. **Storytelling**
|
| 1221 |
+
- Visual clarity
|
| 1222 |
+
- Pacing
|
| 1223 |
+
- Tension building
|
| 1224 |
+
- Scene purpose achievement
|
| 1225 |
|
| 1226 |
3. **Dialogue Quality**
|
| 1227 |
+
- Naturalness
|
| 1228 |
+
- Character uniqueness
|
| 1229 |
+
- Subtext
|
| 1230 |
+
- Remove exposition
|
| 1231 |
|
| 1232 |
4. **{genre} Genre Fit**
|
| 1233 |
+
- Genre conventions
|
| 1234 |
+
- Tone consistency
|
| 1235 |
+
- Meeting expectations
|
| 1236 |
|
| 1237 |
5. **Technical Aspects**
|
| 1238 |
+
- Page count appropriateness
|
| 1239 |
+
- Production feasibility
|
| 1240 |
+
- Budget considerations
|
| 1241 |
|
| 1242 |
**Required Improvements:**
|
| 1243 |
Provide specific revision suggestions with improved examples."""
|
| 1244 |
+
}
|
| 1245 |
+
|
| 1246 |
+
return lang_prompts.get(language, lang_prompts["English"])
|
| 1247 |
|
| 1248 |
+
def create_final_reviewer_prompt(self, complete_screenplay: str,
|
| 1249 |
+
screenplay_type: str, genre: str, language: str) -> str:
|
| 1250 |
+
"""Final comprehensive review"""
|
| 1251 |
+
|
| 1252 |
+
lang_prompts = {
|
| 1253 |
+
"Korean": f"""๋น์ ์ ์ต์ข
๋ฆฌ๋ทฐ์ด์
๋๋ค. ์์ฑ๋ {screenplay_type} ์๋๋ฆฌ์ค๋ฅผ ์ข
ํฉ ํ๊ฐํ์ธ์.
|
| 1254 |
|
| 1255 |
**ํ๊ฐ ๊ธฐ์ค:**
|
| 1256 |
|
| 1257 |
1. **์์
์ฑ (25์ )**
|
| 1258 |
+
- ์์ฅ์ฑ
|
| 1259 |
+
- ํ๊ฒ ๊ด๊ฐ ์ดํ
|
| 1260 |
+
- ์ ์ ๊ฐ๋ฅ์ฑ
|
| 1261 |
+
- ๋ฐฐ๊ธ ์ ์ฌ๋ ฅ
|
| 1262 |
|
| 1263 |
2. **์คํ ๋ฆฌ (25์ )**
|
| 1264 |
+
- 3๋ง ๊ตฌ์กฐ ํจ๊ณผ์ฑ
|
| 1265 |
+
- ์บ๋ฆญํฐ ์ํฌ
|
| 1266 |
+
- ํ๋กฏ ์ผ๊ด์ฑ
|
| 1267 |
+
- ํ
๋ง ์ ๋ฌ
|
| 1268 |
|
| 1269 |
3. **๊ธฐ์ ์ ์์ฑ๋ (25์ )**
|
| 1270 |
+
- ํฌ๋งท ์ ํ์ฑ
|
| 1271 |
+
- ํ์ด์ง ์ ์ ์ ์ฑ
|
| 1272 |
+
- ์ฌ ๊ตฌ์ฑ
|
| 1273 |
+
- ์๊ฐ์ ์คํ ๋ฆฌํ
๋ง
|
| 1274 |
|
| 1275 |
4. **๋ํ & ์บ๋ฆญํฐ (25์ )**
|
| 1276 |
+
- ๋ํ ์์ฐ์ค๋ฌ์
|
| 1277 |
+
- ์บ๋ฆญํฐ ๊ณ ์ ์ฑ
|
| 1278 |
+
- ๊ด๊ณ ์ญํ
|
| 1279 |
+
- ๊ฐ์ ์ ์ง์ ์ฑ
|
| 1280 |
|
| 1281 |
**์ข
ํฉ ํ๊ฐ:**
|
| 1282 |
- ๊ฐ์ (3-5๊ฐ)
|
|
|
|
| 1288 |
|
| 1289 |
๊ตฌ์ฒด์ ์ด๊ณ ๊ฑด์ค์ ์ธ ํผ๋๋ฐฑ์ ์ ๊ณตํ์ธ์.""",
|
| 1290 |
|
| 1291 |
+
"English": f"""You are the final reviewer. Comprehensively evaluate the completed {screenplay_type} screenplay.
|
| 1292 |
|
| 1293 |
**Evaluation Criteria:**
|
| 1294 |
|
| 1295 |
1. **Commercial Viability (25 points)**
|
| 1296 |
+
- Marketability
|
| 1297 |
+
- Target audience appeal
|
| 1298 |
+
- Production feasibility
|
| 1299 |
+
- Distribution potential
|
| 1300 |
|
| 1301 |
2. **Story (25 points)**
|
| 1302 |
+
- Three-act structure effectiveness
|
| 1303 |
+
- Character arcs
|
| 1304 |
+
- Plot consistency
|
| 1305 |
+
- Theme delivery
|
| 1306 |
|
| 1307 |
3. **Technical Excellence (25 points)**
|
| 1308 |
+
- Format accuracy
|
| 1309 |
+
- Page count appropriateness
|
| 1310 |
+
- Scene construction
|
| 1311 |
+
- Visual storytelling
|
| 1312 |
|
| 1313 |
4. **Dialogue & Character (25 points)**
|
| 1314 |
+
- Dialogue naturalness
|
| 1315 |
+
- Character uniqueness
|
| 1316 |
+
- Relationship dynamics
|
| 1317 |
+
- Emotional authenticity
|
| 1318 |
|
| 1319 |
**Overall Assessment:**
|
| 1320 |
- Strengths (3-5)
|
|
|
|
| 1325 |
**Grade:** A+ to F
|
| 1326 |
|
| 1327 |
Provide specific, constructive feedback."""
|
| 1328 |
+
}
|
| 1329 |
+
|
| 1330 |
+
return lang_prompts.get(language, lang_prompts["English"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1331 |
|
| 1332 |
+
def create_critic_structure_prompt(self, story_structure: str, characters: str,
|
| 1333 |
+
screenplay_type: str, genre: str, language: str) -> str:
|
| 1334 |
+
"""Structure critic prompt"""
|
| 1335 |
+
lang_prompts = {
|
| 1336 |
+
"Korean": f"""๋น์ ์ ๊ตฌ์กฐ ๋นํ๊ฐ์
๋๋ค. ์คํ ๋ฆฌ ๊ตฌ์กฐ์ ์บ๋ฆญํฐ ์ค์ ์ ์ฌ์ธต ๋ถ์ํ์ธ์.
|
| 1337 |
+
|
| 1338 |
+
**์คํ ๋ฆฌ ๊ตฌ์กฐ:**
|
| 1339 |
+
{story_structure}
|
| 1340 |
+
|
| 1341 |
+
**์บ๋ฆญํฐ ์ค์ :**
|
| 1342 |
+
{characters}
|
| 1343 |
+
|
| 1344 |
+
**๋ถ์ ํญ๋ชฉ:**
|
| 1345 |
+
|
| 1346 |
+
1. **3๋ง ๊ตฌ์กฐ ํจ๊ณผ์ฑ**
|
| 1347 |
+
- ๊ฐ ๋ง์ ๊ท ํ
|
| 1348 |
+
- ์ ํ์ ์ ๊ฐ๋
|
| 1349 |
+
- ํ๋กฏ ํฌ์ธํธ์ ๋ช
ํ์ฑ
|
| 1350 |
+
- ํด๋ผ์ด๋งฅ์ค ์์น
|
| 1351 |
+
|
| 1352 |
+
2. **์บ๋ฆญํฐ ์ํฌ ํ๋น์ฑ**
|
| 1353 |
+
- ๋ณํ์ ์ ๋น์ฑ
|
| 1354 |
+
- ๋๊ธฐ์ ๋ช
ํ์ฑ
|
| 1355 |
+
- ๋ด์ /์ธ์ ๋ชฉํ ์ผ์น
|
| 1356 |
+
- ๊ด๊ณ ์ญํ
|
| 1357 |
+
|
| 1358 |
+
3. **ํ
๋ง ํตํฉ**
|
| 1359 |
+
- ํ
๋ง์ ์ผ๊ด์ฑ
|
| 1360 |
+
- ํ๋กฏ๊ณผ ํ
๋ง ์ฐ๊ฒฐ
|
| 1361 |
+
- ์บ๋ฆญํฐ์ ํ
๋ง ์ฐ๊ฒฐ
|
| 1362 |
+
- ์๊ฐ์ ํ
๋ง ํํ
|
| 1363 |
+
|
| 1364 |
+
4. **์ฅ๋ฅด ๊ธฐ๋์น**
|
| 1365 |
+
- {genre} ๊ด์ต ์ถฉ์กฑ
|
| 1366 |
+
- ๋
์ฐฝ์ฑ๊ณผ ์น์ํจ ๊ท ํ
|
| 1367 |
+
- ํ๊ฒ ๊ด๊ฐ ๋ง์กฑ๋
|
| 1368 |
+
|
| 1369 |
+
5. **์ ์ ํ์ค์ฑ**
|
| 1370 |
+
- ์์ฐ ๊ท๋ชจ ์ ์ ์ฑ
|
| 1371 |
+
- ๋ก์ผ์ด์
์คํ ๊ฐ๋ฅ์ฑ
|
| 1372 |
+
- ํน์ํจ๊ณผ ์๊ตฌ์ฌํญ
|
| 1373 |
+
|
| 1374 |
+
**ํ์ ๊ฐ์ ์ ์:**
|
| 1375 |
+
๊ฐ ๋ฌธ์ ์ ์ ๋ํ ๊ตฌ์ฒด์ ํด๊ฒฐ์ฑ
์ ์ ์ํ์ธ์.""",
|
| 1376 |
+
|
| 1377 |
+
"English": f"""You are a structure critic. Deeply analyze story structure and character setup.
|
| 1378 |
+
|
| 1379 |
+
**Story Structure:**
|
| 1380 |
+
{story_structure}
|
| 1381 |
+
|
| 1382 |
+
**Character Setup:**
|
| 1383 |
+
{characters}
|
| 1384 |
+
|
| 1385 |
+
**Analysis Items:**
|
| 1386 |
+
|
| 1387 |
+
1. **Three-Act Structure Effectiveness**
|
| 1388 |
+
- Balance of each act
|
| 1389 |
+
- Strength of transitions
|
| 1390 |
+
- Clarity of plot points
|
| 1391 |
+
- Climax positioning
|
| 1392 |
+
|
| 1393 |
+
2. **Character Arc Validity**
|
| 1394 |
+
- Credibility of change
|
| 1395 |
+
- Clarity of motivation
|
| 1396 |
+
- Internal/external goal alignment
|
| 1397 |
+
- Relationship dynamics
|
| 1398 |
+
|
| 1399 |
+
3. **Theme Integration**
|
| 1400 |
+
- Theme consistency
|
| 1401 |
+
- Plot-theme connection
|
| 1402 |
+
- Character-theme connection
|
| 1403 |
+
- Visual theme expression
|
| 1404 |
+
|
| 1405 |
+
4. **Genre Expectations**
|
| 1406 |
+
- Meeting {genre} conventions
|
| 1407 |
+
- Balance of originality and familiarity
|
| 1408 |
+
- Target audience satisfaction
|
| 1409 |
+
|
| 1410 |
+
5. **Production Reality**
|
| 1411 |
+
- Budget scale appropriateness
|
| 1412 |
+
- Location feasibility
|
| 1413 |
+
- Special effects requirements
|
| 1414 |
+
|
| 1415 |
+
**Required Improvement Suggestions:**
|
| 1416 |
+
Provide specific solutions for each issue."""
|
| 1417 |
+
}
|
| 1418 |
+
|
| 1419 |
+
return lang_prompts.get(language, lang_prompts["English"])
|
| 1420 |
+
|
| 1421 |
+
def _get_genre_scene_guidelines(self, genre: str, language: str) -> str:
|
| 1422 |
+
"""Get genre-specific scene guidelines"""
|
| 1423 |
+
guidelines = {
|
| 1424 |
+
"action": {
|
| 1425 |
+
"Korean": "- ์งง๊ณ ํ์น๊ฐ ์๋ ์ฌ\n- ์ก์
์ํ์ค ์์ธ ๊ณํ\n- ๊ธด์ฅ๊ฐ ์ง์",
|
| 1426 |
+
"English": "- Short, punchy scenes\n- Detailed action sequences\n- Maintain tension"
|
| 1427 |
+
},
|
| 1428 |
+
"thriller": {
|
| 1429 |
+
"Korean": "- ์์คํ์ค ๊ตฌ์ถ\n- ์ ๋ณด ์ ์ง์ ๊ณต๊ฐ\n- ๋ฐ์ ๋ฐฐ์น",
|
| 1430 |
+
"English": "- Build suspense\n- Gradual information reveal\n- Place twists"
|
| 1431 |
+
},
|
| 1432 |
+
"drama": {
|
| 1433 |
+
"Korean": "- ๊ฐ์ ์ ๋นํธ ๊ฐ์กฐ\n- ์บ๋ฆญํฐ ์ค์ฌ ์ฌ\n- ๋ํ ๊ณต๊ฐ ํ๋ณด",
|
| 1434 |
+
"English": "- Emphasize emotional beats\n- Character-driven scenes\n- Allow dialogue space"
|
| 1435 |
+
},
|
| 1436 |
+
"comedy": {
|
| 1437 |
+
"Korean": "- ์
์
๊ณผ ํ์ด์คํ\n- ์ฝ๋ฏน ํ์ด๋ฐ\n- ์๊ฐ์ ๊ฐ๊ทธ",
|
| 1438 |
+
"English": "- Setup and payoff\n- Comic timing\n- Visual gags"
|
| 1439 |
+
},
|
| 1440 |
+
"horror": {
|
| 1441 |
+
"Korean": "- ๋ถ์๊ธฐ ์กฐ์ฑ\n- ์ ํ ์ค์ผ์ด ๋ฐฐ์น\n- ๊ธด์ฅ๊ณผ ์ด์",
|
| 1442 |
+
"English": "- Atmosphere building\n- Jump scare placement\n- Tension and release"
|
| 1443 |
+
},
|
| 1444 |
+
"sci-fi": {
|
| 1445 |
+
"Korean": "- ์ธ๊ณ๊ด ์ค๋ช
\n- ์๊ฐ์ ์คํํฐํด\n- ๊ฐ๋
์๊ฐ",
|
| 1446 |
+
"English": "- World building\n- Visual spectacle\n- Concept introduction"
|
| 1447 |
+
},
|
| 1448 |
+
"romance": {
|
| 1449 |
+
"Korean": "- ๊ฐ์ ์ ์น๋ฐ๊ฐ\n- ๊ด๊ณ ๋ฐ์ \n- ๋ก๋งจํฑ ๋นํธ",
|
| 1450 |
+
"English": "- Emotional intimacy\n- Relationship progression\n- Romantic beats"
|
| 1451 |
+
}
|
| 1452 |
+
}
|
| 1453 |
+
|
| 1454 |
+
return guidelines.get(genre, guidelines["drama"]).get(language, "")
|
| 1455 |
+
|
| 1456 |
+
def _extract_act_scenes(self, scene_breakdown: str, act: str) -> str:
|
| 1457 |
+
"""Extract scenes for specific act"""
|
| 1458 |
+
# This would parse the scene breakdown and return only scenes for the requested act
|
| 1459 |
+
# For now, returning a placeholder
|
| 1460 |
+
return f"Scenes for {act} from the breakdown"
|
| 1461 |
+
|
| 1462 |
+
# --- LLM call functions ---
|
| 1463 |
+
def call_llm_sync(self, messages: List[Dict[str, str]], role: str, language: str) -> str:
|
| 1464 |
+
full_content = ""
|
| 1465 |
+
for chunk in self.call_llm_streaming(messages, role, language):
|
| 1466 |
+
full_content += chunk
|
| 1467 |
+
if full_content.startswith("โ"):
|
| 1468 |
+
raise Exception(f"LLM Call Failed: {full_content}")
|
| 1469 |
+
return full_content
|
| 1470 |
+
|
| 1471 |
+
def call_llm_streaming(self, messages: List[Dict[str, str]], role: str,
|
| 1472 |
+
language: str) -> Generator[str, None, None]:
|
| 1473 |
+
try:
|
| 1474 |
+
system_prompts = self.get_system_prompts(language)
|
| 1475 |
+
full_messages = [{"role": "system", "content": system_prompts.get(role, "")}, *messages]
|
| 1476 |
+
|
| 1477 |
+
max_tokens = 15000 if role == "screenwriter" else 8000
|
| 1478 |
+
|
| 1479 |
+
payload = {
|
| 1480 |
+
"model": self.model_id,
|
| 1481 |
+
"messages": full_messages,
|
| 1482 |
+
"max_tokens": max_tokens,
|
| 1483 |
+
"temperature": 0.7 if role in ["screenwriter", "script_doctor"] else 0.8,
|
| 1484 |
+
"top_p": 0.9,
|
| 1485 |
+
"presence_penalty": 0.3,
|
| 1486 |
+
"frequency_penalty": 0.3,
|
| 1487 |
+
"stream": True
|
| 1488 |
+
}
|
| 1489 |
+
|
| 1490 |
+
response = requests.post(
|
| 1491 |
+
self.api_url,
|
| 1492 |
+
headers=self.create_headers(),
|
| 1493 |
+
json=payload,
|
| 1494 |
+
stream=True,
|
| 1495 |
+
timeout=180
|
| 1496 |
+
)
|
| 1497 |
+
|
| 1498 |
+
if response.status_code != 200:
|
| 1499 |
+
yield f"โ API Error (Status Code: {response.status_code})"
|
| 1500 |
+
return
|
| 1501 |
+
|
| 1502 |
+
buffer = ""
|
| 1503 |
+
for line in response.iter_lines():
|
| 1504 |
+
if not line:
|
| 1505 |
+
continue
|
| 1506 |
+
|
| 1507 |
+
try:
|
| 1508 |
+
line_str = line.decode('utf-8').strip()
|
| 1509 |
+
if not line_str.startswith("data: "):
|
| 1510 |
+
continue
|
| 1511 |
+
|
| 1512 |
+
data_str = line_str[6:]
|
| 1513 |
+
if data_str == "[DONE]":
|
| 1514 |
+
break
|
| 1515 |
+
|
| 1516 |
+
data = json.loads(data_str)
|
| 1517 |
+
choices = data.get("choices", [])
|
| 1518 |
+
if choices and choices[0].get("delta", {}).get("content"):
|
| 1519 |
+
content = choices[0]["delta"]["content"]
|
| 1520 |
+
buffer += content
|
| 1521 |
+
|
| 1522 |
+
if len(buffer) >= 50 or '\n' in buffer:
|
| 1523 |
+
yield buffer
|
| 1524 |
+
buffer = ""
|
| 1525 |
+
time.sleep(0.01)
|
| 1526 |
+
|
| 1527 |
+
except Exception as e:
|
| 1528 |
+
logger.error(f"Chunk processing error: {str(e)}")
|
| 1529 |
+
continue
|
| 1530 |
+
|
| 1531 |
+
if buffer:
|
| 1532 |
+
yield buffer
|
| 1533 |
+
|
| 1534 |
+
except Exception as e:
|
| 1535 |
+
logger.error(f"Streaming error: {type(e).__name__}: {str(e)}")
|
| 1536 |
+
yield f"โ Error occurred: {str(e)}"
|
| 1537 |
+
|
| 1538 |
+
def get_system_prompts(self, language: str) -> Dict[str, str]:
|
| 1539 |
+
"""Role-specific system prompts"""
|
| 1540 |
+
|
| 1541 |
+
base_prompts = {
|
| 1542 |
+
"Korean": {
|
| 1543 |
+
"producer": """๋น์ ์ 20๋
๊ฒฝ๋ ฅ์ ํ ๋ฆฌ์ฐ๋ ํ๋ก๋์์
๋๋ค.
|
| 1544 |
์์
์ ์ฑ๊ณต๊ณผ ์์ ์ ๊ฐ์น๋ฅผ ๋ชจ๋ ์ถ๊ตฌํฉ๋๋ค.
|
| 1545 |
์์ฅ ํธ๋ ๋์ ๊ด๊ฐ ์ฌ๋ฆฌ๋ฅผ ์ ํํ ํ์
ํฉ๋๋ค.
|
| 1546 |
์คํ ๊ฐ๋ฅํ๊ณ ๋งค๋ ฅ์ ์ธ ํ๋ก์ ํธ๋ฅผ ๊ฐ๋ฐํฉ๋๋ค.""",
|
| 1547 |
+
|
| 1548 |
+
"story_developer": """๋น์ ์ ์์ ๊ฒฝ๋ ฅ์ด ์๋ ์คํ ๋ฆฌ ๊ฐ๋ฐ์์
๋๋ค.
|
| 1549 |
๊ฐ์ ์ ์ผ๋ก ๊ณต๊ฐ๊ฐ๊ณ ๊ตฌ์กฐ์ ์ผ๋ก ํํํ ์ด์ผ๊ธฐ๋ฅผ ๋ง๋ญ๋๋ค.
|
| 1550 |
์บ๋ฆญํฐ์ ๋ด์ ์ฌ์ ๊ณผ ์ธ์ ๏ฟฝ๏ฟฝ๏ฟฝ๋กฏ์ ์กฐํ๋กญ๊ฒ ์ฎ์ต๋๋ค.
|
| 1551 |
๋ณดํธ์ ์ฃผ์ ๋ฅผ ๋
ํนํ ๋ฐฉ์์ผ๋ก ํ๊ตฌํฉ๋๋ค.""",
|
| 1552 |
+
|
| 1553 |
+
"character_designer": """๋น์ ์ ์ฌ๋ฆฌํ์ ๊ณต๋ถํ ์บ๋ฆญํฐ ๋์์ด๋์
๋๋ค.
|
| 1554 |
์ง์ง ๊ฐ์ ์ธ๋ฌผ๋ค์ ์ฐฝ์กฐํ๋ ์ ๋ฌธ๊ฐ์
๋๋ค.
|
| 1555 |
๊ฐ ์บ๋ฆญํฐ์๊ฒ ๊ณ ์ ํ ๋ชฉ์๋ฆฌ์ ๊ด์ ์ ๋ถ์ฌํฉ๋๋ค.
|
| 1556 |
๋ณต์กํ๊ณ ๋ชจ์์ ์ธ ์ธ๊ฐ์ฑ์ ํฌ์ฐฉํฉ๋๋ค.""",
|
| 1557 |
+
|
| 1558 |
+
"scene_planner": """๋น์ ์ ์ ๋ฐํ ์ฌ ๊ตฌ์ฑ์ ๋๊ฐ์
๋๋ค.
|
| 1559 |
๊ฐ ์ฌ์ด ์คํ ๋ฆฌ์ ์บ๋ฆญํฐ๋ฅผ ์ ์ง์ํค๋๋ก ์ค๊ณํฉ๋๋ค.
|
| 1560 |
๋ฆฌ๋ฌ๊ณผ ํ์ด์ฑ์ ์๋ฒฝํ๊ฒ ์กฐ์ ํฉ๋๋ค.
|
| 1561 |
์๊ฐ์ ์คํ ๋ฆฌํ
๋ง์ ๊ทน๋ํํฉ๋๋ค.""",
|
| 1562 |
+
|
| 1563 |
+
"screenwriter": """๋น์ ์ ๋ค์์ ์๋๋ฆฌ์ค ์๊ฐ์
๋๋ค.
|
| 1564 |
'๋ณด์ฌ์ฃผ๊ธฐ'์ ๋๊ฐ์ด๋ฉฐ ์๋ธํ
์คํธ๋ฅผ ๋ฅ์ํ๊ฒ ๋ค๋ฃน๋๋ค.
|
| 1565 |
์์ํ๊ณ ์์ฐ์ค๋ฌ์ด ๋ํ๋ฅผ ์ฐ๋ ์ ๋ฌธ๊ฐ์
๋๋ค.
|
| 1566 |
์ ์ ํ์ค์ ๊ณ ๋ คํ๋ฉด์๋ ์ฐฝ์์ ์ธ ํด๊ฒฐ์ฑ
์ ์ฐพ์ต๋๋ค.""",
|
| 1567 |
+
|
| 1568 |
+
"script_doctor": """๋น์ ์ ๊น๋ค๋ก์ด ์คํฌ๋ฆฝํธ ๋ฅํฐ์
๋๋ค.
|
| 1569 |
์์ ๋ํ
์ผ๋ ๋์น์ง ์๋ ์๋ฒฝ์ฃผ์์์
๋๋ค.
|
| 1570 |
์คํ ๋ฆฌ์ ์ ์ฌ๋ ฅ์ ์ต๋ํ ๋์ด๋
๋๋ค.
|
| 1571 |
๊ฑด์ค์ ์ด๊ณ ๊ตฌ์ฒด์ ์ธ ๊ฐ์ ์์ ์ ์ํฉ๋๋ค.""",
|
| 1572 |
+
|
| 1573 |
+
"critic_structure": """๋น์ ์ ๊ตฌ์กฐ ๋ถ์ ์ ๋ฌธ๊ฐ์
๋๋ค.
|
| 1574 |
์คํ ๋ฆฌ์ ๋ผ๋์ ๊ทผ์ก์ ๊ฟฐ๋ซ์ด ๋ด
๋๋ค.
|
| 1575 |
๋
ผ๋ฆฌ์ ํ์ ๊ณผ ๊ฐ์ ์ ๊ณต๋ฐฑ์ ์ฐพ์๋
๋๋ค.
|
| 1576 |
๋ ๋์ ๊ตฌ์กฐ๋ฅผ ์ํ ๊ตฌ์ฒด์ ์ ์์ ํฉ๋๋ค.""",
|
| 1577 |
+
|
| 1578 |
+
"final_reviewer": """๋น์ ์ ์
๊ณ ๋ฒ ํ
๋ ์ต์ข
๋ฆฌ๋ทฐ์ด์
๋๋ค.
|
| 1579 |
์์
์ฑ๊ณผ ์์ ์ฑ์ ๊ท ํ์๊ฒ ํ๊ฐํฉ๋๋ค.
|
| 1580 |
์ ์์ฌ, ๋ฐฐ์ฐ, ๊ด๊ฐ ๋ชจ๋ ๊ด์ ์ ๊ณ ๋ คํฉ๋๋ค.
|
| 1581 |
๋์ ํ์ง๋ง ๊ฒฉ๋ คํ๋ ํผ๋๋ฐฑ์ ์ ๊ณตํฉ๋๋ค."""
|
| 1582 |
+
},
|
| 1583 |
+
"English": {
|
| 1584 |
+
"producer": """You are a Hollywood producer with 20 years experience.
|
| 1585 |
You pursue both commercial success and artistic value.
|
| 1586 |
You accurately grasp market trends and audience psychology.
|
| 1587 |
You develop feasible and attractive projects.""",
|
| 1588 |
+
|
| 1589 |
+
"story_developer": """You are an award-winning story developer.
|
| 1590 |
You create emotionally resonant and structurally sound stories.
|
| 1591 |
You harmoniously weave internal journeys with external plots.
|
| 1592 |
You explore universal themes in unique ways.""",
|
| 1593 |
+
|
| 1594 |
+
"character_designer": """You are a character designer who studied psychology.
|
| 1595 |
You're an expert at creating lifelike characters.
|
| 1596 |
You give each character a unique voice and perspective.
|
| 1597 |
You capture complex and contradictory humanity.""",
|
| 1598 |
+
|
| 1599 |
+
"scene_planner": """You are a master of precise scene construction.
|
| 1600 |
You design each scene to advance story and character.
|
| 1601 |
You perfectly control rhythm and pacing.
|
| 1602 |
You maximize visual storytelling.""",
|
| 1603 |
+
|
| 1604 |
+
"screenwriter": """You are a prolific screenwriter.
|
| 1605 |
You're a master of 'showing' and skilled with subtext.
|
| 1606 |
You're an expert at writing vivid, natural dialogue.
|
| 1607 |
You find creative solutions while considering production reality.""",
|
| 1608 |
+
|
| 1609 |
+
"script_doctor": """You are a demanding script doctor.
|
| 1610 |
You're a perfectionist who misses no small detail.
|
| 1611 |
You maximize the story's potential.
|
| 1612 |
You provide constructive and specific improvements.""",
|
| 1613 |
+
|
| 1614 |
+
"critic_structure": """You are a structure analysis expert.
|
| 1615 |
You see through the story's skeleton and muscles.
|
| 1616 |
You find logical gaps and emotional voids.
|
| 1617 |
You make specific suggestions for better structure.""",
|
| 1618 |
+
|
| 1619 |
+
"final_reviewer": """You are an industry veteran final reviewer.
|
| 1620 |
You evaluate commercial and artistic value in balance.
|
| 1621 |
You consider all perspectives: producers, actors, audience.
|
| 1622 |
You provide feedback that's critical yet encouraging."""
|
| 1623 |
+
}
|
| 1624 |
+
}
|
| 1625 |
+
|
| 1626 |
+
return base_prompts.get(language, base_prompts["English"])
|
| 1627 |
|
| 1628 |
+
# --- Main process ---
|
| 1629 |
def process_screenplay_stream(self, query: str, screenplay_type: str, genre: str,
|
| 1630 |
language: str, session_id: Optional[str] = None
|
| 1631 |
) -> Generator[Tuple[str, List[Dict[str, Any]], str], None, None]:
|
|
|
|
| 1718 |
logger.error(f"Screenplay generation error: {e}", exc_info=True)
|
| 1719 |
yield f"โ Error occurred: {e}", stages if 'stages' in locals() else [], self.current_session_id
|
| 1720 |
|
|
|
|
|
|
|
| 1721 |
def get_stage_prompt(self, stage_idx: int, role: str, query: str,
|
| 1722 |
+
screenplay_type: str, genre: str, language: str,
|
| 1723 |
+
stages: List[Dict]) -> str:
|
| 1724 |
+
"""Generate stage-specific prompt"""
|
| 1725 |
+
if stage_idx == 0: # Producer
|
| 1726 |
+
return self.create_producer_prompt(query, screenplay_type, genre, language)
|
| 1727 |
+
|
| 1728 |
+
if stage_idx == 1: # Story Developer
|
| 1729 |
+
return self.create_story_developer_prompt(
|
| 1730 |
+
stages[0]["content"], query, screenplay_type, genre, language
|
| 1731 |
+
)
|
| 1732 |
+
|
| 1733 |
+
if stage_idx == 2: # Character Designer
|
| 1734 |
+
return self.create_character_designer_prompt(
|
| 1735 |
+
stages[0]["content"], stages[1]["content"], genre, language
|
| 1736 |
+
)
|
| 1737 |
+
|
| 1738 |
+
if stage_idx == 3: # Structure Critic
|
| 1739 |
+
return self.create_critic_structure_prompt(
|
| 1740 |
+
stages[1]["content"], stages[2]["content"], screenplay_type, genre, language
|
| 1741 |
+
)
|
| 1742 |
+
|
| 1743 |
+
if stage_idx == 4: # Scene Planner
|
| 1744 |
+
return self.create_scene_planner_prompt(
|
| 1745 |
+
stages[1]["content"], stages[2]["content"], screenplay_type, genre, language
|
| 1746 |
+
)
|
| 1747 |
+
|
| 1748 |
+
# Screenwriter acts
|
| 1749 |
+
if role == "screenwriter":
|
| 1750 |
+
act_mapping = {5: "Act 1", 7: "Act 2A", 9: "Act 2B", 11: "Act 3"}
|
| 1751 |
+
if stage_idx in act_mapping:
|
| 1752 |
+
act = act_mapping[stage_idx]
|
| 1753 |
+
previous_acts = self._get_previous_acts(stages, stage_idx)
|
| 1754 |
+
return self.create_screenwriter_prompt(
|
| 1755 |
+
act, stages[4]["content"], stages[2]["content"],
|
| 1756 |
+
previous_acts, screenplay_type, genre, language
|
| 1757 |
+
)
|
| 1758 |
+
|
| 1759 |
+
# Script doctor reviews
|
| 1760 |
+
if role == "script_doctor":
|
| 1761 |
+
act_mapping = {6: "Act 1", 8: "Act 2A", 10: "Act 2B"}
|
| 1762 |
+
if stage_idx in act_mapping:
|
| 1763 |
+
act = act_mapping[stage_idx]
|
| 1764 |
+
act_content = stages[stage_idx-1]["content"]
|
| 1765 |
+
return self.create_script_doctor_prompt(act_content, act, genre, language)
|
| 1766 |
+
|
| 1767 |
+
# Final reviewer
|
| 1768 |
+
if role == "final_reviewer":
|
| 1769 |
+
complete_screenplay = ScreenplayDatabase.get_screenplay_content(self.current_session_id)
|
| 1770 |
+
return self.create_final_reviewer_prompt(
|
| 1771 |
+
complete_screenplay, screenplay_type, genre, language
|
| 1772 |
+
)
|
| 1773 |
+
|
| 1774 |
+
return ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1775 |
|
| 1776 |
def _get_previous_acts(self, stages: List[Dict], current_idx: int) -> str:
|
| 1777 |
+
"""Get previous acts content"""
|
| 1778 |
+
previous = []
|
| 1779 |
+
act_indices = {5: [], 7: [5], 9: [5, 7], 11: [5, 7, 9]}
|
| 1780 |
+
|
| 1781 |
+
if current_idx in act_indices:
|
| 1782 |
+
for idx in act_indices[current_idx]:
|
| 1783 |
+
if idx < len(stages) and stages[idx]["content"]:
|
| 1784 |
+
previous.append(stages[idx]["content"])
|
| 1785 |
+
|
| 1786 |
+
return "\n\n---\n\n".join(previous) if previous else ""
|
| 1787 |
|
| 1788 |
def _process_producer_content(self, content: str):
|
| 1789 |
+
"""Process producer output"""
|
| 1790 |
+
# Extract title and logline
|
| 1791 |
+
title_match = re.search(r'(?:TITLE|์ ๋ชฉ):\s*(.+)', content)
|
| 1792 |
+
logline_match = re.search(r'(?:LOGLINE|๋ก๊ทธ๋ผ์ธ):\s*(.+)', content)
|
| 1793 |
+
|
| 1794 |
+
if title_match:
|
| 1795 |
+
self.screenplay_tracker.screenplay_bible.title = title_match.group(1).strip()
|
| 1796 |
+
if logline_match:
|
| 1797 |
+
self.screenplay_tracker.screenplay_bible.logline = logline_match.group(1).strip()
|
| 1798 |
+
|
| 1799 |
+
# Save to database
|
| 1800 |
+
ScreenplayDatabase.save_screenplay_bible(self.current_session_id,
|
| 1801 |
+
self.screenplay_tracker.screenplay_bible)
|
| 1802 |
|
| 1803 |
def _process_story_content(self, content: str):
|
| 1804 |
+
"""Process story developer output"""
|
| 1805 |
+
# Extract three-act structure
|
| 1806 |
+
self.screenplay_tracker.screenplay_bible.three_act_structure = {
|
| 1807 |
+
"act1": self._extract_section(content, "ACT 1|์ 1๋ง"),
|
| 1808 |
+
"act2a": self._extract_section(content, "ACT 2A|์ 2๋งA"),
|
| 1809 |
+
"act2b": self._extract_section(content, "ACT 2B|์ 2๋งB"),
|
| 1810 |
+
"act3": self._extract_section(content, "ACT 3|์ 3๋ง")
|
| 1811 |
+
}
|
| 1812 |
+
|
| 1813 |
+
ScreenplayDatabase.save_screenplay_bible(self.current_session_id,
|
| 1814 |
+
self.screenplay_tracker.screenplay_bible)
|
| 1815 |
|
| 1816 |
def _process_character_content(self, content: str):
|
| 1817 |
+
"""Process character designer output"""
|
| 1818 |
+
# Extract protagonist
|
| 1819 |
+
protagonist_section = self._extract_section(content, "PROTAGONIST|์ฃผ์ธ๊ณต")
|
| 1820 |
+
if protagonist_section:
|
| 1821 |
+
protagonist = self._parse_character_profile(protagonist_section, "protagonist")
|
| 1822 |
+
self.screenplay_tracker.add_character(protagonist)
|
| 1823 |
+
ScreenplayDatabase.save_character(self.current_session_id, protagonist)
|
| 1824 |
+
|
| 1825 |
+
# Extract antagonist
|
| 1826 |
+
antagonist_section = self._extract_section(content, "ANTAGONIST|์ ๋์")
|
| 1827 |
+
if antagonist_section:
|
| 1828 |
+
antagonist = self._parse_character_profile(antagonist_section, "antagonist")
|
| 1829 |
+
self.screenplay_tracker.add_character(antagonist)
|
| 1830 |
+
ScreenplayDatabase.save_character(self.current_session_id, antagonist)
|
| 1831 |
|
| 1832 |
def _process_scene_content(self, content: str):
|
| 1833 |
+
"""Process scene planner output"""
|
| 1834 |
+
# Parse scene breakdown
|
| 1835 |
+
scene_pattern = r'(?:Scene|์ฌ)\s*(\d+).*?(?:INT\.|EXT\.)\s*(.+?)\s*-\s*(\w+)'
|
| 1836 |
+
scenes = re.finditer(scene_pattern, content, re.IGNORECASE | re.MULTILINE)
|
| 1837 |
+
|
| 1838 |
+
for match in scenes:
|
| 1839 |
+
scene_num = int(match.group(1))
|
| 1840 |
+
location = match.group(2).strip()
|
| 1841 |
+
time_of_day = match.group(3).strip()
|
| 1842 |
+
|
| 1843 |
+
# Determine act based on scene number
|
| 1844 |
+
act = 1 if scene_num <= 12 else 2 if scene_num <= 35 else 3
|
| 1845 |
+
|
| 1846 |
+
scene = SceneBreakdown(
|
| 1847 |
+
scene_number=scene_num,
|
| 1848 |
+
act=act,
|
| 1849 |
+
location=location,
|
| 1850 |
+
time_of_day=time_of_day,
|
| 1851 |
+
characters=[], # Would be extracted from content
|
| 1852 |
+
purpose="", # Would be extracted from content
|
| 1853 |
+
conflict="", # Would be extracted from content
|
| 1854 |
+
page_count=1.5 # Default estimate
|
| 1855 |
+
)
|
| 1856 |
+
|
| 1857 |
+
self.screenplay_tracker.add_scene(scene)
|
| 1858 |
+
ScreenplayDatabase.save_scene(self.current_session_id, scene)
|
| 1859 |
|
| 1860 |
def _extract_section(self, content: str, section_pattern: str) -> str:
|
| 1861 |
+
"""Extract section from content"""
|
| 1862 |
+
pattern = rf'(?:{section_pattern})[:\s]*(.+?)(?=\n(?:[A-Z]{{2,}}|[๊ฐ-ํฃ]{{2,}}):|\Z)'
|
| 1863 |
+
match = re.search(pattern, content, re.IGNORECASE | re.DOTALL)
|
| 1864 |
+
return match.group(1).strip() if match else ""
|
| 1865 |
|
| 1866 |
def _parse_character_profile(self, content: str, role: str) -> CharacterProfile:
|
| 1867 |
+
"""Parse character profile from content"""
|
| 1868 |
+
# Extract character details using regex or string parsing
|
| 1869 |
+
name = self._extract_field(content, "Name|์ด๋ฆ") or f"Character_{role}"
|
| 1870 |
+
age = int(self._extract_field(content, "Age|๋์ด") or "30")
|
| 1871 |
+
|
| 1872 |
+
return CharacterProfile(
|
| 1873 |
+
name=name,
|
| 1874 |
+
age=age,
|
| 1875 |
+
role=role,
|
| 1876 |
+
archetype=self._extract_field(content, "Archetype|์ํฌํ์
") or "",
|
| 1877 |
+
want=self._extract_field(content, "WANT|์ธ์ ๋ชฉํ") or "",
|
| 1878 |
+
need=self._extract_field(content, "NEED|๋ด์ ํ์") or "",
|
| 1879 |
+
backstory=self._extract_field(content, "Backstory|๋ฐฑ์คํ ๋ฆฌ") or "",
|
| 1880 |
+
personality=[], # Would be parsed from content
|
| 1881 |
+
speech_pattern=self._extract_field(content, "Speech|๋งํฌ") or "",
|
| 1882 |
+
character_arc=self._extract_field(content, "Arc|์ํฌ") or ""
|
| 1883 |
+
)
|
| 1884 |
|
| 1885 |
def _extract_field(self, content: str, field_pattern: str) -> Optional[str]:
|
| 1886 |
+
"""Extract field value from content"""
|
| 1887 |
+
pattern = rf'(?:{field_pattern})[:\s]*(.+?)(?=\n|$)'
|
| 1888 |
+
match = re.search(pattern, content, re.IGNORECASE)
|
| 1889 |
+
return match.group(1).strip() if match else None
|
| 1890 |
|
| 1891 |
# --- Utility functions ---
|
| 1892 |
def generate_random_screenplay_theme(screenplay_type: str, genre: str, language: str) -> str:
|