mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
feat: experimental markdown support (#658)
* feat: test button * fix: enter * fix: bing suggested * fix: bing suggested * fix: bing suggested * fix: button under icqq * fix: 删除suno心跳 * fix: add default md handler * fix: duplicate this * fix: add a button * Update md.js * Update md.js * fix: api stream * fix: claude.ai * fix: md enhancement * fix: optional buttons * fix: mode name * fix: ignore md while not enable md
This commit is contained in:
parent
58e6201e6e
commit
cb3e57bea3
11 changed files with 610 additions and 126 deletions
40
apps/md.js
Normal file
40
apps/md.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import plugin from '../../../lib/plugins/plugin.js'
|
||||
import {Config} from '../utils/config.js'
|
||||
|
||||
export class ChatGPTMarkdownHandler extends plugin {
|
||||
constructor () {
|
||||
super({
|
||||
name: 'chatgptmd处理器',
|
||||
priority: -100,
|
||||
namespace: 'chatgpt-plugin',
|
||||
handler: [{
|
||||
key: 'chatgpt.markdown.convert',
|
||||
fn: 'mdHandler'
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
async mdHandler (e, options, reject) {
|
||||
const { content, prompt, use } = options
|
||||
if (Config.enableMd) {
|
||||
let mode = transUse(use)
|
||||
return `> ${prompt}\n\n---\n${content}\n\n---\n*当前模式:${mode}*`
|
||||
} else {
|
||||
return content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function transUse (use) {
|
||||
let useMap = {
|
||||
api: Config.model,
|
||||
bing: '必应(Copilot)' + Config.toneStyle,
|
||||
gemini: Config.geminiModel,
|
||||
xh: '讯飞星火 ' + Config.xhmode,
|
||||
qwen: '通义千问 ' + Config.qwenModel,
|
||||
claude2: 'Claude 3 Sonnet',
|
||||
glm4: 'ChatGLM4',
|
||||
chat3: 'ChatGPT官网'
|
||||
}
|
||||
return useMap[use] || use
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue