mirror of
https://github.com/idootop/mi-gpt.git
synced 2025-04-13 13:00:55 +00:00
feat: 允许通过设置 systemTemplate 为空字符串来关闭系统消息
This commit is contained in:
parent
84a46b688b
commit
6e73ce8eee
|
@ -9,6 +9,7 @@ import { withDefault } from "../utils/base";
|
|||
import { ChatCompletionCreateParamsBase } from "openai/resources/chat/completions";
|
||||
import { Logger } from "../utils/log";
|
||||
import { kProxyAgent } from "./proxy";
|
||||
import { isNotEmpty } from "../utils/is";
|
||||
|
||||
export interface ChatOptions {
|
||||
user: string;
|
||||
|
@ -68,8 +69,8 @@ class OpenAIClient {
|
|||
`🔥 onAskAI\n🤖️ System: ${system ?? "None"}\n😊 User: ${user}`.trim()
|
||||
);
|
||||
}
|
||||
const systemMsg: ChatCompletionMessageParam[] = system
|
||||
? [{ role: "system", content: system }]
|
||||
const systemMsg: ChatCompletionMessageParam[] = isNotEmpty(system)
|
||||
? [{ role: "system", content: system! }]
|
||||
: [];
|
||||
let signal: AbortSignal | undefined;
|
||||
if (requestId) {
|
||||
|
@ -120,8 +121,8 @@ class OpenAIClient {
|
|||
`🔥 onAskAI\n🤖️ System: ${system ?? "None"}\n😊 User: ${user}`.trim()
|
||||
);
|
||||
}
|
||||
const systemMsg: ChatCompletionMessageParam[] = system
|
||||
? [{ role: "system", content: system }]
|
||||
const systemMsg: ChatCompletionMessageParam[] = isNotEmpty(system)
|
||||
? [{ role: "system", content: system! }]
|
||||
: [];
|
||||
const stream = await this._client!.chat.completions.create({
|
||||
model,
|
||||
|
|
Loading…
Reference in New Issue
Block a user