MCPcopy
hub / github.com/Bistutu/FluentRead / commonMsgTemplate

Function commonMsgTemplate

entrypoints/utils/template.ts:6–25  ·  view source on GitHub ↗
(origin: string)

Source from the content-addressed store, hash-verified

4
5// openai 格式的消息模板(通用模板)
6export function commonMsgTemplate(origin: string) {
7 // 检测是否使用自定义模型
8 let model = config.model[config.service] === customModelString ? config.customModel[config.service] : config.model[config.service]
9
10 // 删除模型名称中的中文括号及其内容,如"gpt-4(推荐)" -> "gpt-4"
11 model = model.replace(/(.*)/g, "");
12
13 let system = config.system_role[config.service] || defaultOption.system_role;
14 let user = (config.user_role[config.service] || defaultOption.user_role)
15 .replace('{{to}}', config.to).replace('{{origin}}', origin);
16
17 return JSON.stringify({
18 'model': model,
19 "temperature": 1.0,
20 'messages': [
21 {'role': 'system', 'content': system},
22 {'role': 'user', 'content': user},
23 ]
24 })
25}
26
27// deepseek
28export function deepseekMsgTemplate(origin: string) {

Callers 7

commonFunction · 0.90
azureOpenaiFunction · 0.90
infiniFunction · 0.90
newapiFunction · 0.90
customFunction · 0.90
grokFunction · 0.90
zhipuFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected