chanfasf commited on
Commit
dc77916
·
verified ·
1 Parent(s): 58d0f60

Upload app.js with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.js +29 -0
app.js CHANGED
@@ -90,6 +90,30 @@ const PROVIDERS = {
90
  ],
91
  note: '💡 支持模型轮调:自动选择余额充足的模型,低于 10% 自动切换。显示各模型剩余 tokens 和使用进度。'
92
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  }
94
  };
95
 
@@ -1171,6 +1195,11 @@ async function streamChat(p, apiKey, messages, onDelta, modelOverride, provider)
1171
  base = 'https://open.bigmodel.cn/api/paas/v4';
1172
  headers = { 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}` };
1173
  endpoint = '/chat/completions'; // 智谱端点
 
 
 
 
 
1174
  } else {
1175
  // ChatGPT:走本地中继或 Worker
1176
  base = apiBase();
 
90
  ],
91
  note: '💡 支持模型轮调:自动选择余额充足的模型,低于 10% 自动切换。显示各模型剩余 tokens 和使用进度。'
92
  }
93
+ },
94
+ chatsam: {
95
+ name: 'CHATSAM(内置童锦程 Skill)',
96
+ baseUrl: 'https://chanfasf-chatsam.hf.space',
97
+ defaultModel: 'gpt-4o',
98
+ models: ['gpt-4o', 'gpt-4o-mini', 'gpt-4.1', 'gpt-4.1-mini', 'o1', 'o1-mini', 'o3', 'o3-mini'],
99
+ usesTokenPool: true,
100
+ keyUrl: 'https://chatgpt.com',
101
+ free: true,
102
+ guide: {
103
+ access: '通过 CHATSAM 后端调用 ChatGPT,自动注入童锦程 Skill',
104
+ price: '免费,使用你的 ChatGPT 账号额度',
105
+ pay: '用你自己的 ChatGPT 账号',
106
+ keyFormat: 'ChatGPT 官网 access_token(eyJ... 开头的 JWT)',
107
+ steps: [
108
+ '打开 chatgpt.com 登录你的账号',
109
+ 'F12 打开开发者工具 → Application → Cookies',
110
+ '复制 __Secure-next-auth.session-token 的值(JWT 格式)',
111
+ '或者用 https://chatgpt.com/api/auth/session 拿 access_token',
112
+ '把 access_token 粘贴到下方「账号池」添加',
113
+ 'CHATSAM 后端会自动注入最新的童锦程 Skill'
114
+ ],
115
+ note: '💡 无需手动配置 Skill,CHATSAM 后端已内置最新的「童锦程话术体系 + 多话术选择模式」。'
116
+ }
117
  }
118
  };
119
 
 
1195
  base = 'https://open.bigmodel.cn/api/paas/v4';
1196
  headers = { 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}` };
1197
  endpoint = '/chat/completions'; // 智谱端点
1198
+ } else if (provider === 'chatsam') {
1199
+ // CHATSAM:直连 CHATSAM 后端,自动注入 Skill
1200
+ base = PROVIDERS.chatsam.baseUrl;
1201
+ headers = { 'Content-Type': 'application/json', 'X-Account-Token': apiKey };
1202
+ endpoint = '/v1/chat/completions';
1203
  } else {
1204
  // ChatGPT:走本地中继或 Worker
1205
  base = apiBase();