-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen_with_ai.py
More file actions
34 lines (27 loc) · 1.16 KB
/
Copy pathgen_with_ai.py
File metadata and controls
34 lines (27 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""兼容壳:原 gen_with_ai.py 的 CLI 用法保持不变,实现已迁移到 ai/ 包。
用法示例:
python gen_with_ai.py "生成《培训项目变更审批表》"
python gen_with_ai.py "生成《培训项目变更审批表》" -k 你的Key -m 模型 -u https://api.deepseek.com/v1
"""
import argparse
import sys
from config import DEFAULT_API_KEY, DEFAULT_MODEL, DEFAULT_BASE_URL
from ai import client as ai_client
from ai import prompts as ai_prompts
def _main(argv=None):
parser = argparse.ArgumentParser(description="AI 生成结构化 Word 模板文本")
parser.add_argument("description", help="表单需求描述")
parser.add_argument("-k", "--key", default=DEFAULT_API_KEY)
parser.add_argument("-m", "--model", default=DEFAULT_MODEL)
parser.add_argument("-u", "--base-url", default=DEFAULT_BASE_URL)
args = parser.parse_args(argv)
raw = ai_client.call_deepseek(
args.key, args.model, args.base_url,
ai_prompts.load_system_prompt(), args.description,
)
print(ai_client.strip_code_fence(raw))
return 0
if __name__ == "__main__":
sys.exit(_main())