Commit 26570415 by chenjinjing

no message

parent 46eb12ab
......@@ -10,7 +10,7 @@ import { AIANSWERTYPE } from "../../config/enum";
export async function getAIAnswerInterface(question, sceneUuids, threadId) {
const interfaceName = "获取问数结果信息";
let body = {question, sceneUuids, threadId};
// let data = await getInterfaceByInterfaceName( dataCenterInterfaceConfig.answerText, body );
let data = await getInterfaceByInterfaceName( dataCenterInterfaceConfig.answerText, body );
/**----------------test */
// let sample = {header:[], data:[]};
......@@ -50,21 +50,21 @@ export async function getAIAnswerInterface(question, sceneUuids, threadId) {
// ];
// }
let data = {
questionId:"",
content:"",
params:[],
sample:null
}
// let data = {
// questionId:"",
// content:"",
// params:[],
// sample:null
// }
if (question == "今年营销项目带来多少收入") {
data.content = "为您查询:项目启动时间${filterValue1}的收入${filterValue3}为636181.6320754716552286";
data.params = [
{name:"filterValue1", display:"大于等于2025-01-01"},
{name:"filterValue2", display:"123"},
{name:"filterValue3", display:"营销项目金额"},
];
}
// if (question == "今年营销项目带来多少收入") {
// data.content = "为您查询:项目启动时间${filterValue1}的收入${filterValue3}为636181.6320754716552286";
// data.params = [
// {name:"filterValue1", display:"大于等于2025-01-01"},
// {name:"filterValue2", display:"123"},
// {name:"filterValue3", display:"营销项目金额"},
// ];
// }
/**----------------test */
......@@ -75,18 +75,22 @@ export async function getAIAnswerInterface(question, sceneUuids, threadId) {
if (!sample) {
let aiAnswerStr = replacePlaceholders(content, params);
// // 1. 找到最后一个 "为" 的位置
// let lastWeiIndex = aiAnswerStr.lastIndexOf("为");
// let beforeWei = "";
// let afterWei = "";
// if (lastWeiIndex !== -1) {
// // 2. 截取 "为" 前面的部分(不包含"为")
// beforeWei = aiAnswerStr.slice(0, lastWeiIndex);
// // 3. 截取 "为" 后面的部分(不包含"为")
// afterWei = aiAnswerStr.slice(lastWeiIndex + 1); // +1 跳过 "为" 字
// }
// 1. 找到最后一个 "为" 的位置
let lastWeiIndex = aiAnswerStr.lastIndexOf("为");
let beforeWei = "";
let afterWei = "";
let afterWeiNum;
if (lastWeiIndex !== -1) {
// 2. 截取 "为" 前面的部分(不包含"为")
beforeWei = aiAnswerStr.slice(0, lastWeiIndex);
// 3. 截取 "为" 后面的部分(不包含"为")
afterWei = aiAnswerStr.slice(lastWeiIndex + 1); // +1 跳过 "为" 字
let afterWeiFloat = parseFloat(afterWei);
if (isNaN(afterWeiFloat)) afterWeiNum = afterWei;
afterWeiNum = afterWeiFloat.toFixed(2);
}
aiAnswerType = AIANSWERTYPE.文本;
aiAnswerData = aiAnswerStr;
aiAnswerData = `${beforeWei}${afterWeiNum}`;
} else if (!Object.keys(sample).length) {
throw new SysError(SYSTEMERRORENUM.未按接口协议返回, interfaceName, "sample 为空", sample);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment