yangxiaohui пре 1 месец
родитељ
комит
4c2ea7fafd
2 измењених фајлова са 19 додато и 2 уклоњено
  1. 1 0
      .gitignore
  2. 18 2
      sug_v2.py

+ 1 - 0
.gitignore

@@ -2,3 +2,4 @@ data
 __pycache__
 *.swp
 tmp
+logs

+ 18 - 2
sug_v2.py

@@ -19,6 +19,8 @@ from pydantic import BaseModel, Field
 
 
 class RunContext(BaseModel):
+    version: str = Field(..., description="当前运行的脚本版本(文件名)")
+    input_files: dict[str, str] = Field(..., description="输入文件路径映射,如 {'context_file': '...', 'q_file': '...'}")
     q_with_context: str
     q_context: str
     q: str
@@ -238,8 +240,13 @@ insrtuctions = """
 
 async def main():
     current_time, log_url = set_trace()
-    q_context = read_file_as_string('input/kg_v1_single_context.md')
-    q = read_file_as_string('input/kg_v1_single_q.md')
+
+    # 输入文件路径
+    input_context_file = 'input/kg_v1_single_context.md'
+    input_q_file = 'input/kg_v1_single_q.md'
+
+    q_context = read_file_as_string(input_context_file)
+    q = read_file_as_string(input_q_file)
     q_with_context = f"""
 <需求上下文>
 {q_context}
@@ -249,7 +256,16 @@ async def main():
 </当前问题>
 """.strip()
     log_dir = os.path.join("logs", current_time)
+
+    # 获取当前文件名作为版本
+    version = os.path.basename(__file__)
+
     run_context = RunContext(
+        version=version,
+        input_files={
+            "context_file": input_context_file,
+            "q_file": input_q_file,
+        },
         q_with_context=q_with_context,
         q_context=q_context,
         q=q,