Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

针对知道的新形态课程(AI课) #98

Merged
merged 4 commits into from
Oct 24, 2024

Conversation

zh2250635
Copy link

代码变更

fucker.py

  1. 新增 ExamCtx 类:用于完成 AI 课程的课后测试
  2. 新增 Openai 类:用于使用 AI 生成答案
  3. 新增 PptToTxt 类:用于将 PPT 的文字提取出来,为 AI 提供参考。提取文本的api使用月之暗面提供的免费api,参考文档:https://platform.moonshot.cn/docs/api/files
  4. 添加一系列与 AI 课程相关的方法,用于完成 AI 课程

zd_utils.py

  • 新增密钥 AI_KEY

配置变更

添加了 AI 相关配置项:

"ai": {
    "enabled": true,
    "use_zhidao_ai": false,
    "openai": {
        "api_base": "https://api.openai.com",
        "api_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
        "model_name": "claude-3-5-sonnet-20240620"
    },
    "ppt_processing": {
        "provide_to_ai": true,
        "moonShot": {
            "base_url": "https://api.moonshot.cn/v1",
            "api_key": "sk-",
            "delete_after_convert": true
        }
    },
    "use_stream": true
}

配置说明:

  • enabled: 是否使用 AI 生成答案,否则使用随机答案
  • use_zhidao_ai: 是否使用知道的 AI 对话生成答案,否则使用 OpenAI
  • ppt_processing: 控制将 PPT 提供给 AI 的行为
  • use_stream: AI 回答是否使用流式回答,可提高获取答案的速度

命令行参数

main.py 中添加了新的启动参数:

parser.add_argument("-ai", "--aicourse", type=str, nargs=2,
                    metavar=('COURSE_ID', 'CLASS_ID'),
                    help="AI Course ID and CLASS ID to fuck aiCourse")

parser.add_argument("--noexam", type=bool,
                    help="Disable AI exam")

@VermiIIi0n
Copy link
Owner

谢谢这位操树士,我先 merge 了,之后我改下 config 部分的逻辑就 release 新版本

@VermiIIi0n VermiIIi0n merged commit dd29922 into VermiIIi0n:master Oct 24, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants