Files

1 line
9.8 KiB
JSON

{"repo": "caoye04/docodeclub", "files": {"1st_DoCodeClub_202505/hw/yan_jiahe/core/llm.py": {"9b0996b21603ef8927e45b78a73fe4c72de2f14c": {"t": 1785745411.7112012, "n": 1616, "h": "3e55d4f17e06c29d", "c": "import requests\nimport json\nfrom config import DEEPSEEK_API_KEY, DEEPSEEK_API_URL\n\n\nclass DeepSeekLLM:\n def __init__(self, api_key=None):\n ###############################\n # TODO: 设置 API Key 和 API 地址\n self.api_key = api_key or DEEPSEEK_API_KEY\n self.api_url = DEEPSEEK_API_URL\n ###############################\n\n def generate_response(self, messages, model=\"DeepSeek-R1-Distill-32B\", temperature=0.6,\n max_tokens=4000, repetition_penalty=1.2, stream=False):\n \"\"\"\n 使用DeepSeek API生成响应\n\n Args:\n messages: 消息历史列表,格式为[{\"role\": \"user\", \"content\": \"...\"}, ...]\n model: 使用的模型名称\n temperature: 温度参数,控制随机性\n max_tokens: 最大生成令牌数\n repetition_penalty: 重复惩罚系数\n stream: 是否启用流式传输\n\n Returns:\n 生成的响应文本\n \"\"\"\n headers = {\n \"Content-Type\": \"application/json\",\n \"Authorization\": f\"Bearer {self.api_key}\"\n }\n\n payload = {\n \"model\": model,\n \"messages\": messages,\n \"temperature\": temperature,\n \"max_tokens\": max_tokens,\n \"repetition_penalty\": repetition_penalty,\n \"stream\": stream\n }\n\n try:\n response = requests.post(self.api_url, headers=headers, json=payload, timeout=60)\n response.raise_for_status()\n return response.json()[\"choices\"][0][\"message\"][\"content\"]\n except Exception as e:\n print(f\"Error calling DeepSeek API: {e}\")\n return f\"Sorry, I encountered an error: {str(e)}\"\n"}, "ac01cb6f7944ca616b96ca53dcbaeb0e8729dddc": {"t": 1785752941.5882685, "n": 1616, "h": "3e55d4f17e06c29d", "c": "import requests\nimport json\nfrom config import DEEPSEEK_API_KEY, DEEPSEEK_API_URL\n\n\nclass DeepSeekLLM:\n def __init__(self, api_key=None):\n ###############################\n # TODO: 设置 API Key 和 API 地址\n self.api_key = api_key or DEEPSEEK_API_KEY\n self.api_url = DEEPSEEK_API_URL\n ###############################\n\n def generate_response(self, messages, model=\"DeepSeek-R1-Distill-32B\", temperature=0.6,\n max_tokens=4000, repetition_penalty=1.2, stream=False):\n \"\"\"\n 使用DeepSeek API生成响应\n\n Args:\n messages: 消息历史列表,格式为[{\"role\": \"user\", \"content\": \"...\"}, ...]\n model: 使用的模型名称\n temperature: 温度参数,控制随机性\n max_tokens: 最大生成令牌数\n repetition_penalty: 重复惩罚系数\n stream: 是否启用流式传输\n\n Returns:\n 生成的响应文本\n \"\"\"\n headers = {\n \"Content-Type\": \"application/json\",\n \"Authorization\": f\"Bearer {self.api_key}\"\n }\n\n payload = {\n \"model\": model,\n \"messages\": messages,\n \"temperature\": temperature,\n \"max_tokens\": max_tokens,\n \"repetition_penalty\": repetition_penalty,\n \"stream\": stream\n }\n\n try:\n response = requests.post(self.api_url, headers=headers, json=payload, timeout=60)\n response.raise_for_status()\n return response.json()[\"choices\"][0][\"message\"][\"content\"]\n except Exception as e:\n print(f\"Error calling DeepSeek API: {e}\")\n return f\"Sorry, I encountered an error: {str(e)}\"\n"}}, "1st_DoCodeClub_202505/hw/zhouhz24/code2/config.py": {"9b0996b21603ef8927e45b78a73fe4c72de2f14c": {"t": 1785745412.0389426, "n": 350, "h": "460dcbe3472921f4", "c": "import os\nfrom dotenv import load_dotenv\n\n# 加载环境变量\nload_dotenv()\n\n# DeepSeek API配置\nDEEPSEEK_API_KEY = os.getenv(\"DEEPSEEK_API_KEY\")\nDEEPSEEK_API_URL = \"https://api.deepseek.com/v1/chat/completions\"\nDEEPSEEK_API_URL = \"https://madmodel.cs.tsinghua.edu.cn/v1/chat/completions\"\n# 应用配置\nDEBUG = True\nSECRET_KEY = os.getenv(\"SECRET_KEY\", \"your-secret-key\")"}, "7f9b79b1d4f1397de4723c8ad24556763b8f9fa2": {"t": 1785752940.9374514, "n": 350, "h": "460dcbe3472921f4", "c": "import os\nfrom dotenv import load_dotenv\n\n# 加载环境变量\nload_dotenv()\n\n# DeepSeek API配置\nDEEPSEEK_API_KEY = os.getenv(\"DEEPSEEK_API_KEY\")\nDEEPSEEK_API_URL = \"https://api.deepseek.com/v1/chat/completions\"\nDEEPSEEK_API_URL = \"https://madmodel.cs.tsinghua.edu.cn/v1/chat/completions\"\n# 应用配置\nDEBUG = True\nSECRET_KEY = os.getenv(\"SECRET_KEY\", \"your-secret-key\")"}}, "1st_DoCodeClub_202505/hw/li_ruolan24/hw3_code/config.py": {"9b0996b21603ef8927e45b78a73fe4c72de2f14c": {"t": 1785745443.1700482, "n": 491, "h": "be879210b8f7e0b6", "c": "import os\nfrom dotenv import load_dotenv\n\n# 加载环境变量\nload_dotenv()\n\n# DeepSeek API配置\nDEEPSEEK_API_KEY = os.getenv(\"DEEPSEEK_API_KEY\")\nDEEPSEEK_API_URL = \"https://api.deepseek.com/v1/chat/completions\"\n\n# 如果使用清华镜像,取消注释下一行\n#DEEPSEEK_API_URL = \"https://madmodel.cs.tsinghua.edu.cn/v1/chat/completions\"\n\n# 应用配置\nDEBUG = True\nSECRET_KEY = os.getenv(\"SECRET_KEY\", \"your-secret-key-2025\")\n\n# 聊天配置\nMAX_CONVERSATION_HISTORY = 10\nDEFAULT_MODEL = \"deepseek-chat\"\nDEFAULT_TEMPERATURE = 0.7\nMAX_TOKENS = 4000"}, "655df43efd95aa70d3cd98f333499358c8e8fd0e": {"t": 1785752941.605046, "n": 491, "h": "be879210b8f7e0b6", "c": "import os\nfrom dotenv import load_dotenv\n\n# 加载环境变量\nload_dotenv()\n\n# DeepSeek API配置\nDEEPSEEK_API_KEY = os.getenv(\"DEEPSEEK_API_KEY\")\nDEEPSEEK_API_URL = \"https://api.deepseek.com/v1/chat/completions\"\n\n# 如果使用清华镜像,取消注释下一行\n#DEEPSEEK_API_URL = \"https://madmodel.cs.tsinghua.edu.cn/v1/chat/completions\"\n\n# 应用配置\nDEBUG = True\nSECRET_KEY = os.getenv(\"SECRET_KEY\", \"your-secret-key-2025\")\n\n# 聊天配置\nMAX_CONVERSATION_HISTORY = 10\nDEFAULT_MODEL = \"deepseek-chat\"\nDEFAULT_TEMPERATURE = 0.7\nMAX_TOKENS = 4000"}}, "1st_DoCodeClub_202505/hw/example-unfinished-hw3-code/config.py": {"9b0996b21603ef8927e45b78a73fe4c72de2f14c": {"t": 1785745456.4875827, "n": 492, "h": "c7bf78b8fa5882b3", "c": "import os\nfrom dotenv import load_dotenv\n\n# 加载环境变量\nload_dotenv()\n\n# DeepSeek API配置\nDEEPSEEK_API_KEY = os.getenv(\"DEEPSEEK_API_KEY\")\nDEEPSEEK_API_URL = \"https://api.deepseek.com/v1/chat/completions\"\n\n# 如果使用清华镜像,取消注释下一行\n# DEEPSEEK_API_URL = \"https://madmodel.cs.tsinghua.edu.cn/v1/chat/completions\"\n\n# 应用配置\nDEBUG = True\nSECRET_KEY = os.getenv(\"SECRET_KEY\", \"your-secret-key-2025\")\n\n# 聊天配置\nMAX_CONVERSATION_HISTORY = 10\nDEFAULT_MODEL = \"deepseek-chat\"\nDEFAULT_TEMPERATURE = 0.7\nMAX_TOKENS = 4000"}, "c632c7f79e9f69900a6f4fdb49bcb888f930b9cf": {"t": 1785752941.5569205, "n": 492, "h": "c7bf78b8fa5882b3", "c": "import os\nfrom dotenv import load_dotenv\n\n# 加载环境变量\nload_dotenv()\n\n# DeepSeek API配置\nDEEPSEEK_API_KEY = os.getenv(\"DEEPSEEK_API_KEY\")\nDEEPSEEK_API_URL = \"https://api.deepseek.com/v1/chat/completions\"\n\n# 如果使用清华镜像,取消注释下一行\n# DEEPSEEK_API_URL = \"https://madmodel.cs.tsinghua.edu.cn/v1/chat/completions\"\n\n# 应用配置\nDEBUG = True\nSECRET_KEY = os.getenv(\"SECRET_KEY\", \"your-secret-key-2025\")\n\n# 聊天配置\nMAX_CONVERSATION_HISTORY = 10\nDEFAULT_MODEL = \"deepseek-chat\"\nDEFAULT_TEMPERATURE = 0.7\nMAX_TOKENS = 4000"}}, "1st_DoCodeClub_202505/hw/Homeworks_of_Sunwang/HW2/readme.md": {"9b0996b21603ef8927e45b78a73fe4c72de2f14c": {"t": 1785747264.9928868, "n": 527, "h": "a14cf610d962f272", "c": "这是作业2的框架代码,你需要将 core\\agent.py 和 core\\llm.py 中标注了 `TODO` 的地方补全代码。\n\n当然,你也可以自由地修改其他地方的代码。\n\n\n运行指南如下\n\n1. 安装依赖\n\n 运行 `pip install -r .\\requirement.txt`\n\n2. 申请API\n\n 本项目用的清华 deepseek 的 API\n 可以在网址:https://madmodel.cs.tsinghua.edu.cn/ 中,右下角“API使用指南”,复制token。(每次登录后,token的有效期为5个小时)\n\n\n3. 配置API环境文件\n\n 添加`.env`文件\n 在文件中输入:\n ```\n DEEPSEEK_API_KEY= your api_keys\n SECRET_KEY= anything if you want (i write my studentNum)\n ```\n\n4. 运行\n\n 在命令行中输入:`python app.py` ,启动端口5000\n\n5. 聊天\n\n 在命令行里输入:`python chat.py`,启动终端聊天窗口\n"}, "9872f5aa2eace8833bf88913bfb34dd5c2a7439e": {"t": 1785752941.787437, "n": 527, "h": "a14cf610d962f272", "c": "这是作业2的框架代码,你需要将 core\\agent.py 和 core\\llm.py 中标注了 `TODO` 的地方补全代码。\n\n当然,你也可以自由地修改其他地方的代码。\n\n\n运行指南如下\n\n1. 安装依赖\n\n 运行 `pip install -r .\\requirement.txt`\n\n2. 申请API\n\n 本项目用的清华 deepseek 的 API\n 可以在网址:https://madmodel.cs.tsinghua.edu.cn/ 中,右下角“API使用指南”,复制token。(每次登录后,token的有效期为5个小时)\n\n\n3. 配置API环境文件\n\n 添加`.env`文件\n 在文件中输入:\n ```\n DEEPSEEK_API_KEY= your api_keys\n SECRET_KEY= anything if you want (i write my studentNum)\n ```\n\n4. 运行\n\n 在命令行中输入:`python app.py` ,启动端口5000\n\n5. 聊天\n\n 在命令行里输入:`python chat.py`,启动终端聊天窗口\n"}}}}