aI问答支持流式输出,效果非常好

This commit is contained in:
zhonghua.li
2026-03-31 21:04:53 +08:00
parent 60da0e2dd5
commit 22f951b514
163 changed files with 4646 additions and 8010 deletions

View File

@@ -1,7 +1,7 @@
"use strict";
const common_vendor = require("./vendor.js");
const uniStarter_config = require("../uni-starter.config.js");
const db = common_vendor.tr.database();
const db = common_vendor._r.database();
function isLoginApi(url) {
if (!url)
return false;
@@ -146,7 +146,7 @@ async function initApp() {
common_vendor.index.__f__("error", "at common/appInit.js:235", code, message);
}
db.on("error", onDBError);
common_vendor.tr.interceptObject({
common_vendor._r.interceptObject({
async invoke({
objectName,
// 云对象名称

View File

@@ -83,11 +83,12 @@ function request(options = {}) {
};
if (needToken && !isLoginApi(fullUrl)) {
const token = getToken();
if (token) {
requestHeader["Authorization"] = `Bearer ${token}`;
} else {
delete requestHeader["Authorization"];
if (!token) {
common_vendor.index.__f__("warn", "at common/request.js:142", "[Request] token 为空,拦截请求并跳转到登录页面");
redirectToLogin();
return Promise.reject(new Error("未登录或登录已失效,请先登录"));
}
requestHeader["Authorization"] = `Bearer ${token}`;
}
const roleName = getRoleName();
if (roleName) {
@@ -101,7 +102,7 @@ function request(options = {}) {
if (needTenantId) {
const tenantId = getTenantId();
if (!isLoginApi(fullUrl) && !tenantId) {
common_vendor.index.__f__("warn", "at common/request.js:170", "[Request] 租户ID为空跳转到登录页面");
common_vendor.index.__f__("warn", "at common/request.js:172", "[Request] 租户ID为空跳转到登录页面");
redirectToLogin();
return Promise.reject(new Error("未登录,请先登录"));
}
@@ -109,7 +110,7 @@ function request(options = {}) {
requestHeader["X-Tenant-Id"] = tenantId;
}
}
common_vendor.index.__f__("log", "at common/request.js:183", "[Request] 准备发起 uni.request:", {
common_vendor.index.__f__("log", "at common/request.js:185", "[Request] 准备发起 uni.request:", {
url: fullUrl,
method: method.toUpperCase(),
hasData: !!requestData,
@@ -117,7 +118,7 @@ function request(options = {}) {
timeout
});
return new Promise((resolve, reject) => {
common_vendor.index.__f__("log", "at common/request.js:192", "[Request] 调用 uni.request 开始执行");
common_vendor.index.__f__("log", "at common/request.js:194", "[Request] 调用 uni.request 开始执行");
common_vendor.index.request({
url: fullUrl,
method: method.toUpperCase(),
@@ -126,7 +127,7 @@ function request(options = {}) {
timeout,
...restOptions,
success: (res) => {
common_vendor.index.__f__("log", "at common/request.js:201", "[Request] 收到响应:", {
common_vendor.index.__f__("log", "at common/request.js:203", "[Request] 收到响应:", {
url: fullUrl,
method: method.toUpperCase(),
statusCode: res.statusCode,
@@ -134,7 +135,7 @@ function request(options = {}) {
dataType: typeof res.data
});
if (res.statusCode === 401) {
common_vendor.index.__f__("warn", "at common/request.js:211", "[Request] 收到401状态码跳转到登录页面");
common_vendor.index.__f__("warn", "at common/request.js:213", "[Request] 收到401状态码跳转到登录页面");
redirectToLogin();
reject(new Error("登录已过期,请重新登录"));
return;
@@ -142,7 +143,7 @@ function request(options = {}) {
resolve(res);
},
fail: (err) => {
common_vendor.index.__f__("error", "at common/request.js:219", "[Request] 请求失败:", {
common_vendor.index.__f__("error", "at common/request.js:221", "[Request] 请求失败:", {
url: fullUrl,
method: method.toUpperCase(),
error: err,

View File

@@ -40,6 +40,12 @@ const pages = [
componentPlaceholder: {
QualityCoveragePopup: "pages-subpackage/ai_features/quality_coverage/quality-coverage-popup"
}
},
{
path: "pages/ai_qa/ai_qa",
style: {
navigationStyle: "custom"
}
}
];
const subPackages = [
@@ -189,12 +195,6 @@ const subPackages = [
navigationBarTitleText: "文章详情"
}
},
{
path: "meeting_summary/meeting_summary",
style: {
navigationStyle: "custom"
}
},
{
path: "workspace/workspace",
style: {
@@ -214,18 +214,6 @@ const subPackages = [
navigationStyle: "custom"
}
},
{
path: "reception/reception",
style: {
navigationStyle: "custom"
}
},
{
path: "customer/customer",
style: {
navigationStyle: "custom"
}
},
{
path: "uni-agree/uni-agree",
style: {
@@ -295,6 +283,60 @@ const subPackages = [
style: {
navigationStyle: "custom"
}
},
{
path: "ai_qa/general_qa/general_qa",
style: {
navigationStyle: "custom"
}
},
{
path: "ai_qa/demand_qa/demand_qa",
style: {
navigationStyle: "custom"
}
},
{
path: "ai_qa/price_qa/price_qa",
style: {
navigationStyle: "custom"
}
},
{
path: "ai_qa/trust_qa/trust_qa",
style: {
navigationStyle: "custom"
}
},
{
path: "ai_qa/decision_qa/decision_qa",
style: {
navigationStyle: "custom"
}
},
{
path: "ai_qa/competitor_qa/competitor_qa",
style: {
navigationStyle: "custom"
}
},
{
path: "ai_qa/objection_qa/objection_qa",
style: {
navigationStyle: "custom"
}
},
{
path: "ai_qa/sharp_qa/sharp_qa",
style: {
navigationStyle: "custom"
}
},
{
path: "ai_qa/after_sales_qa/after_sales_qa",
style: {
navigationStyle: "custom"
}
}
]
}
@@ -310,12 +352,6 @@ const globalStyle = {
};
const condition = {
list: [
{
path: "pages-subpackage/reception/reception"
},
{
path: "pages-subpackage/customer/customer"
},
{
path: "pages-subpackage/list/detail"
},
@@ -323,7 +359,7 @@ const condition = {
path: "pages-subpackage/ucenter/settings/settings"
}
],
current: 1
current: 0
};
const tabBar = {
custom: false,
@@ -344,6 +380,12 @@ const tabBar = {
selectedIconPath: "static/tabbar/customer_active.png",
text: "客户"
},
{
pagePath: "pages/ai_qa/ai_qa",
iconPath: "static/tabbar/expression.png",
selectedIconPath: "static/tabbar/expression_active.png",
text: "AI问答"
},
{
pagePath: "pages/ai_analysis/ai_analysis",
iconPath: "static/tabbar/ai_analysis.png",

File diff suppressed because it is too large Load Diff