90 lines
2.3 KiB
Python
90 lines
2.3 KiB
Python
#!/usr/bin/env python
|
||
# -*- coding: utf-8 -*-
|
||
"""
|
||
@File : config.py
|
||
@Time : 2023/09/28 23:24:26
|
||
@Author : lvguanjun
|
||
@Desc : config.py
|
||
"""
|
||
|
||
|
||
# 服务器配置
|
||
server_config = {
|
||
"host": "0.0.0.0",
|
||
"port": 14826,
|
||
"token": [
|
||
"github_fuck_you",
|
||
"speedcow_cocopilot"
|
||
],
|
||
}
|
||
|
||
|
||
# GITHUB接口相关
|
||
|
||
# 获取copilot token接口相关
|
||
GET_TOKEN_URL = "https://api.github.com/copilot_internal/v2/token"
|
||
GET_TOKEN_ROUTE = "/copilot_internal/v2/token"
|
||
GITHUB_TOKEN = [
|
||
"ghu_DsDTMH8qVZ0rMBRmEeOs58Lld9ph7f3ksQG9",
|
||
"ghu_n8lITpC5zIZbJcO4vKT7OvWecL72VR4TIJvA",
|
||
"ghu_imVg2YvyaQU0UQXXqJkZvJGhfINLdI3m3xNl",
|
||
"ghu_DcmIu1UFLT1wysiSfA3lA87yCxhXsY0oqgnt",
|
||
]
|
||
|
||
# 代码提示接口相关
|
||
COMPLETION_URL = (
|
||
"https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex/completions"
|
||
)
|
||
COMPLETION_ROUTE = "/v1/engines/copilot-codex/completions"
|
||
|
||
# copilot-chat接口相关
|
||
CHAT_COMPLETION_URL = "https://api.githubcopilot.com/chat/completions"
|
||
CHAT_COMPLETION_ROUTE = "/chat/completions"
|
||
|
||
# github获取token的接口,无需更改
|
||
GITHUB_GET_TOKEN_URL = "https://api.github.com/copilot_internal/v2/token"
|
||
|
||
# 企业认证相关
|
||
|
||
# 是否使用企业认证鉴权
|
||
USE_ENTERPRISE_AUTH = False
|
||
# 企业认证账密,为空字典则无需验证
|
||
ENTERPRISE_AUTH_USERS = {}
|
||
|
||
|
||
# 其他
|
||
|
||
# 是否开启代理“提示请求”
|
||
# 作为代理服务端,应该可以自定义是否开启代理“提示请求”,而不是仅由客户端是否配置决定
|
||
PROXY_COMPLETION_REQUEST = True
|
||
|
||
# 一个github token最多请求失败次数
|
||
TOKEN_MAX_ERR_COUNT = 5
|
||
|
||
# log debug模式
|
||
LOG_DEBUG = True
|
||
|
||
|
||
# chatgpt 相关接口/示例提供的 pandora 接口,也可以用官方接口
|
||
# 感谢 zhile 大佬
|
||
|
||
# 是否使用 chatgpt 代理 copilot-chat,需要 PROXY_COMPLETION_REQUEST 为 True
|
||
USE_GPT_PROXY = True
|
||
GPT_CHAT_URL = "https://api.mooai.top/v1/chat/completions"
|
||
GPT_KEY = "sk-Z6STYK2djqhetK8U448cB8Ef660640128e021e524b321996"
|
||
GPT_MODEL = "gpt-3.5-turbo" # gpt-3.5-turbo, gpt-4, gpt-4-32k
|
||
|
||
# 需要清除的请求头
|
||
CLEAR_HEADERS = [
|
||
"Host",
|
||
"X-Real-Ip",
|
||
"X-Forwarded-For",
|
||
"X-Forwarded-Proto",
|
||
]
|
||
|
||
# 是否代理 /v1/chat/completions 接口
|
||
PROXY_GPT_CHAT_COMPLETION: bool = False
|
||
|
||
# 是否匹配公共建议,理论上该设置不会生效,不过保留试试
|
||
PUBLIC_SUGGESTIONS = "enabled" # enabled, disabled
|