mirror of
https://github.com/jie65535/JChatGPT.git
synced 2025-07-28 18:59:20 +08:00
Add temperature config
This commit is contained in:
parent
7e1a1ad0aa
commit
7d911f2fb6
@ -314,6 +314,7 @@ object JChatGPT : KotlinPlugin(
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
val history = mutableListOf<ChatMessage>()
|
||||
if (PluginConfig.prompt.isNotEmpty()) {
|
||||
val prompt = getSystemPrompt(event)
|
||||
@ -326,7 +327,7 @@ object JChatGPT : KotlinPlugin(
|
||||
logger.info("History: $historyText")
|
||||
history.add(ChatMessage.User(historyText))
|
||||
|
||||
try {
|
||||
|
||||
var done: Boolean
|
||||
// 至少循环3次
|
||||
var retry = max(PluginConfig.retryMax, 3)
|
||||
@ -387,13 +388,13 @@ object JChatGPT : KotlinPlugin(
|
||||
} else {
|
||||
done = false
|
||||
logger.warning("调用llm时发生异常,重试中", e)
|
||||
event.subject.sendMessage(event.message.quote() + "出错了...正在重试...")
|
||||
event.subject.sendMessage("出错了...正在重试...")
|
||||
}
|
||||
}
|
||||
} while (!done && 0 < --retry)
|
||||
} catch (ex: Throwable) {
|
||||
logger.warning(ex)
|
||||
event.subject.sendMessage(event.message.quote() + "很抱歉,发生异常,请稍后重试")
|
||||
event.subject.sendMessage("很抱歉,发生异常,请稍后重试")
|
||||
} finally {
|
||||
// 一段时间后才允许再次提问,防止高频对话
|
||||
launch {
|
||||
@ -728,7 +729,7 @@ object JChatGPT : KotlinPlugin(
|
||||
} else null
|
||||
val request = ChatCompletionRequest(
|
||||
model = ModelId(PluginConfig.chatModel),
|
||||
temperature = 1.3,
|
||||
temperature = PluginConfig.chatTemperature,
|
||||
messages = chatMessages,
|
||||
tools = availableTools,
|
||||
)
|
||||
|
@ -14,6 +14,9 @@ object PluginConfig : AutoSavePluginConfig("Config") {
|
||||
@ValueDescription("Chat模型")
|
||||
var chatModel: String by value("qwen-max")
|
||||
|
||||
@ValueDescription("Chat模型温度,默认为null")
|
||||
var chatTemperature: Double? by value(null)
|
||||
|
||||
@ValueDescription("推理模型API")
|
||||
var reasoningModelApi: String by value("https://dashscope.aliyuncs.com/compatible-mode/v1/")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user