Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1868,16 +1868,21 @@ You provide feedback that's critical yet encouraging."""
|
|
| 1868 |
|
| 1869 |
return "\n\n---\n\n".join(previous) if previous else ""
|
| 1870 |
|
| 1871 |
-
|
| 1872 |
-
|
| 1873 |
-
|
| 1874 |
-
|
| 1875 |
-
|
| 1876 |
-
|
| 1877 |
-
|
| 1878 |
-
|
| 1879 |
-
|
| 1880 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1881 |
|
| 1882 |
def _parse_character_profile(self, content: str, role: str) -> CharacterProfile:
|
| 1883 |
"""Parse character profile from content"""
|
|
|
|
| 1868 |
|
| 1869 |
return "\n\n---\n\n".join(previous) if previous else ""
|
| 1870 |
|
| 1871 |
+
|
| 1872 |
+
def _extract_field(self, content: str, field_pattern: str) -> Optional[str]:
|
| 1873 |
+
"""Extract field value from content with improved parsing"""
|
| 1874 |
+
pattern = rf'{field_pattern}[:\s]*([^\n]+?)(?=\n[A-Z가-힣]|$)'
|
| 1875 |
+
match = re.search(pattern, content, re.IGNORECASE | re.DOTALL)
|
| 1876 |
+
if match and match.group(1):
|
| 1877 |
+
value = match.group(1).strip()
|
| 1878 |
+
value = re.sub(r'\*\*', '', value) # **bold** 제거
|
| 1879 |
+
value = re.sub(r'^\s*[-•]\s*', '', value) # 글머리표 제거
|
| 1880 |
+
value = re.sub(r'[,.:;]+$', '', value) # 행 끝 구두점 제거
|
| 1881 |
+
return value.strip() if value else None
|
| 1882 |
+
return None
|
| 1883 |
+
|
| 1884 |
+
|
| 1885 |
+
|
| 1886 |
|
| 1887 |
def _parse_character_profile(self, content: str, role: str) -> CharacterProfile:
|
| 1888 |
"""Parse character profile from content"""
|