feat(group-agent): 修改自然语言理解模型为自有模型
All checks were successful
Egg Server CI/CD / build-image (push) Successful in 48s
Egg Server CI/CD / refresh-image (push) Successful in 13s
Egg Server CI/CD / fast-deploy (push) Successful in 2s

This commit is contained in:
zhaoyingbo 2024-10-17 09:29:35 +00:00
parent 66229c8546
commit 4e08d68af8
4 changed files with 21 additions and 5 deletions

View File

@ -19,6 +19,7 @@
"langchain", "langchain",
"langfuse", "langfuse",
"metas", "metas",
"MIAI",
"michat", "michat",
"mina", "mina",
"mindnote", "mindnote",

View File

@ -1,6 +1,5 @@
import { parseJsonString } from "@egg/hooks" import { parseJsonString } from "@egg/hooks"
import { LarkEvent } from "@egg/lark-msg-tool" import { LarkEvent } from "@egg/lark-msg-tool"
import logger from "@egg/logger"
import { Context, LarkServer } from "../../../types" import { Context, LarkServer } from "../../../types"
@ -43,7 +42,7 @@ const extractTextFromJson = (data: any): string => {
* @returns * @returns
*/ */
const getChatHistory = async ( const getChatHistory = async (
{ larkService }: Context.Data, { larkService, logger }: Context.Data,
{ {
chatId, chatId,
timeScope, timeScope,

View File

@ -18,6 +18,6 @@ const functionInfo = JSON.stringify([
}, },
]) ])
const userInput = "方糖说了什么" const userInput = "你好"
llm.parseGroupAgentQuery(userInput, groupInfo, functionInfo).then(console.log) llm.parseGroupAgentQuery(userInput, groupInfo, functionInfo).then(console.log)

View File

@ -81,7 +81,8 @@ const parseGroupAgentQuery = async (
groupInfo: string, groupInfo: string,
functionInfo: string functionInfo: string
) => { ) => {
const model = await getModel("gpt-4o") const { langfuseHandler } = await getLangfuse()
const model = await getModel("qwen-72b-instruct-int4/v1")
const structuredLlm = model.withStructuredOutput(groupAgentConfig, { const structuredLlm = model.withStructuredOutput(groupAgentConfig, {
name: "groupAgent", name: "groupAgent",
}) })
@ -91,13 +92,28 @@ const parseGroupAgentQuery = async (
${groupInfo} ${groupInfo}
${functionInfo} ${functionInfo}
IDID IDID
\`\`\`
{
"chatId": "oc_ef98c2a9229657f99d4ef573a30fe91c",
"chatName": "MIAI-FE 人工智能部-前端组",
"functionId": "summary-qwen-72b-instruct-int4",
"functionName": "总结消息",
"startTime": "2022-01-01 00:00:00",
"endTime": "2022-01-01 23:59:59"
}
\`\`\`
\`\`\` \`\`\`
${userInput.replaceAll("`", " ")} ${userInput.replaceAll("`", " ")}
\`\`\` \`\`\`
` `,
{
callbacks: [langfuseHandler],
}
) )
} }