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