mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
feat: version
This commit is contained in:
parent
ba027dc760
commit
aff436007d
8 changed files with 27 additions and 14 deletions
11
apps/chat.js
11
apps/chat.js
|
|
@ -11,12 +11,12 @@ import { KeyvFile } from 'keyv-file'
|
||||||
import { OfficialChatGPTClient } from '../utils/message.js'
|
import { OfficialChatGPTClient } from '../utils/message.js'
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
import { deleteConversation, getConversations, getLatestMessageIdByConversationId } from '../utils/conversation.js'
|
import { deleteConversation, getConversations, getLatestMessageIdByConversationId } from '../utils/conversation.js'
|
||||||
|
let version = Config.version
|
||||||
/**
|
/**
|
||||||
* 每个对话保留的时长。单个对话内ai是保留上下文的。超时后销毁对话,再次对话创建新的对话。
|
* 每个对话保留的时长。单个对话内ai是保留上下文的。超时后销毁对话,再次对话创建新的对话。
|
||||||
* 单位:秒
|
* 单位:秒
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*
|
*
|
||||||
* 这里使用动态数据获取,以便于锅巴动态更新数据
|
* 这里使用动态数据获取,以便于锅巴动态更新数据
|
||||||
*/
|
*/
|
||||||
// const CONVERSATION_PRESERVE_TIME = Config.conversationPreserveTime
|
// const CONVERSATION_PRESERVE_TIME = Config.conversationPreserveTime
|
||||||
|
|
@ -533,7 +533,8 @@ export class chatgpt extends plugin {
|
||||||
senderName: e.sender.nickname,
|
senderName: e.sender.nickname,
|
||||||
quote: quote.length > 0,
|
quote: quote.length > 0,
|
||||||
quotes: quote,
|
quotes: quote,
|
||||||
cache: cacheData
|
cache: cacheData,
|
||||||
|
version
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -716,14 +717,14 @@ export class chatgpt extends plugin {
|
||||||
logger.mark('all conversations: ', conversations)
|
logger.mark('all conversations: ', conversations)
|
||||||
}
|
}
|
||||||
// let conversationsFirst10 = conversations.slice(0, 10)
|
// let conversationsFirst10 = conversations.slice(0, 10)
|
||||||
await e.runtime.render('chatgpt-plugin', 'conversation/chatgpt', { conversations })
|
await e.runtime.render('chatgpt-plugin', 'conversation/chatgpt', { conversations, version })
|
||||||
let text = '对话列表\n'
|
let text = '对话列表\n'
|
||||||
text += '对话id | 对话发起者 \n'
|
text += '对话id | 对话发起者 \n'
|
||||||
conversations.forEach(c => {
|
conversations.forEach(c => {
|
||||||
text += c.id + '|' + (c.creater || '未知') + '\n'
|
text += c.id + '|' + (c.creater || '未知') + '\n'
|
||||||
})
|
})
|
||||||
text += '您可以通过使用命令#chatgpt切换对话+对话id来切换到指定对话,也可以通过命令#chatgpt加入对话+@某人来加入指定人当前进行的对话中。'
|
text += '您可以通过使用命令#chatgpt切换对话+对话id来切换到指定对话,也可以通过命令#chatgpt加入对话+@某人来加入指定人当前进行的对话中。'
|
||||||
await this.reply(text)
|
this.reply(await makeForwardMsg(e, [text], '对话列表'))
|
||||||
} else {
|
} else {
|
||||||
return await this.getConversations(e)
|
return await this.getConversations(e)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
apps/help.js
10
apps/help.js
|
|
@ -1,6 +1,6 @@
|
||||||
import plugin from '../../../lib/plugins/plugin.js'
|
import plugin from '../../../lib/plugins/plugin.js'
|
||||||
import { Config } from '../utils/config.js'
|
import { Config } from '../utils/config.js'
|
||||||
|
let version = Config.version
|
||||||
let helpData = [
|
let helpData = [
|
||||||
{
|
{
|
||||||
group: '聊天',
|
group: '聊天',
|
||||||
|
|
@ -29,8 +29,12 @@ let helpData = [
|
||||||
icon: 'text',
|
icon: 'text',
|
||||||
title: '#chatgpt画图+prompt(/张数/图片大小)',
|
title: '#chatgpt画图+prompt(/张数/图片大小)',
|
||||||
desc: '调用OpenAI Dalle API进行绘图,需要有API key并消耗余额。图片大小只能是256x256/512x512/1024x1024中的一个.默认为1张、512x512'
|
desc: '调用OpenAI Dalle API进行绘图,需要有API key并消耗余额。图片大小只能是256x256/512x512/1024x1024中的一个.默认为1张、512x512'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'text',
|
||||||
|
title: '#chatgpt改图',
|
||||||
|
desc: '调用OpenAI Dalle API进行改图,需要有API key并消耗余额。可同时发送图片或回复图片'
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -127,6 +131,6 @@ export class help extends plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
async help (e) {
|
async help (e) {
|
||||||
await e.runtime.render('chatgpt-plugin', 'help/index', { helpData })
|
await e.runtime.render('chatgpt-plugin', 'help/index', { helpData, version })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
index.js
7
index.js
|
|
@ -1,4 +1,5 @@
|
||||||
import fs from 'node:fs'
|
import fs from 'node:fs'
|
||||||
|
import {Config} from "./utils/config.js";
|
||||||
|
|
||||||
const files = fs.readdirSync('./plugins/chatgpt-plugin/apps').filter(file => file.endsWith('.js'))
|
const files = fs.readdirSync('./plugins/chatgpt-plugin/apps').filter(file => file.endsWith('.js'))
|
||||||
|
|
||||||
|
|
@ -21,4 +22,10 @@ for (let i in files) {
|
||||||
}
|
}
|
||||||
apps[name] = ret[i].value[Object.keys(ret[i].value)[0]]
|
apps[name] = ret[i].value[Object.keys(ret[i].value)[0]]
|
||||||
}
|
}
|
||||||
|
logger.info('**************************************')
|
||||||
|
logger.info('chatgpt-plugin加载成功')
|
||||||
|
logger.info(`当前版本${Config.version}`)
|
||||||
|
logger.info('仓库地址 https://github.com/ikechan8370/chatgpt-plugin')
|
||||||
|
logger.info('插件群号 559567232')
|
||||||
|
logger.info('**************************************')
|
||||||
export { apps }
|
export { apps }
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-10 my-auto text-right">
|
<div class="col-md-10 my-auto text-right">
|
||||||
<div class="copyright-text">
|
<div class="copyright-text">
|
||||||
<p>Response to {{senderName}} Created By Yunzai-Bot and ChatGPT-Plugin</a></p>
|
<p>Response to {{senderName}} Created By Yunzai-Bot and ChatGPT-Plugin {{version}}</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-10 my-auto text-right">
|
<div class="col-md-10 my-auto text-right">
|
||||||
<div class="copyright-text">
|
<div class="copyright-text">
|
||||||
<p>Response to {{senderName}} Created By Yunzai-Bot and ChatGPT-Plugin</a></p>
|
<p>Response to {{senderName}} Created By Yunzai-Bot and ChatGPT-Plugin {{version}}</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="logo">Created By Yunzai-Bot and ChatGPT-Plugin</div>
|
<div class="logo">Created By Yunzai-Bot and ChatGPT-Plugin {{version}}</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="container" id="container">
|
<div class="container" id="container">
|
||||||
<div class="head_box">
|
<div class="head_box">
|
||||||
<div class="id_text">ChatGPT-Plugin</div>
|
<div class="id_text">ChatGPT-Plugin {{version}}</div>
|
||||||
<h2 class="day_text">使用说明</h2>
|
<h2 class="day_text">使用说明</h2>
|
||||||
<img class="chatgpt_logo" src="{{pluResPath}}img/icon/chatgpt.png"/>
|
<img class="chatgpt_logo" src="{{pluResPath}}img/icon/chatgpt.png"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
<div class="logo">Created By Yunzai-Bot and ChatGPT-Plugin</div>
|
<div class="logo">Created By Yunzai-Bot and ChatGPT-Plugin {{version}}</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@ const defaultConfig = {
|
||||||
proxy: '',
|
proxy: '',
|
||||||
debug: true,
|
debug: true,
|
||||||
defaultTimeoutMs: 120000,
|
defaultTimeoutMs: 120000,
|
||||||
chromeTimeoutMS: 120000
|
chromeTimeoutMS: 120000,
|
||||||
|
version: '2.0.0'
|
||||||
}
|
}
|
||||||
const _path = process.cwd()
|
const _path = process.cwd()
|
||||||
let config = {}
|
let config = {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue