perf: outlink config (#3128)

* update action

* perf: outlink config
This commit is contained in:
Archer
2024-11-12 15:56:53 +08:00
committed by archer
parent 73d28d1fc3
commit 5e273341dd
38 changed files with 469 additions and 537 deletions

View File

@@ -90,6 +90,7 @@ export const chats2GPTMessages = ({
}
} else {
const aiResults: ChatCompletionMessageParam[] = [];
//AI
item.value.forEach((value, i) => {
if (value.type === ChatItemValueTypeEnum.tool && value.tools && reserveTool) {
@@ -130,7 +131,7 @@ export const chats2GPTMessages = ({
if (
lastValue &&
lastValue.type === ChatItemValueTypeEnum.text &&
typeof lastResult.content === 'string'
typeof lastResult?.content === 'string'
) {
lastResult.content += value.text.content;
} else {

View File

@@ -10,7 +10,3 @@ export type AuthOutLinkLimitProps = AuthOutLinkChatProps & { outLink: OutLinkSch
export type AuthOutLinkResponse = {
uid: string;
};
export type AuthOutLinkProps = {
shareId?: string;
outLinkUid?: string;
};

View File

@@ -54,7 +54,7 @@ export type OutLinkSchema<T extends OutlinkAppType = undefined> = {
// whether to hide the node status
showNodeStatus: boolean;
// whether to show the complete quote
showCompleteQuote: boolean;
showRawSource: boolean;
// response when request
immediateResponse?: string;
@@ -84,7 +84,7 @@ export type OutLinkEditType<T = undefined> = {
name: string;
responseDetail?: OutLinkSchema<T>['responseDetail'];
showNodeStatus?: OutLinkSchema<T>['showNodeStatus'];
showCompleteQuote?: OutLinkSchema<T>['showCompleteQuote'];
showRawSource?: OutLinkSchema<T>['showRawSource'];
// response when request
immediateResponse?: string;
// response when error or other situation

View File

@@ -89,7 +89,7 @@ try {
// get chat logs;
ChatSchema.index({ teamId: 1, appId: 1, updateTime: -1 }, { background: true });
// get share chat history
ChatSchema.index({ shareId: 1, outLinkUid: 1, updateTime: -1, source: 1 }, { background: true });
ChatSchema.index({ shareId: 1, outLinkUid: 1, updateTime: -1 }, { background: true });
// timer, clear history
ChatSchema.index({ teamId: 1, updateTime: -1 }, { background: true });

View File

@@ -42,27 +42,27 @@ export const getWorkflowResponseWrite = ({
if (!res || res.closed || !useStreamResponse) return;
const detailEvent = [
SseResponseEventEnum.error,
SseResponseEventEnum.flowNodeStatus,
SseResponseEventEnum.flowResponses,
SseResponseEventEnum.interactive,
SseResponseEventEnum.toolCall,
SseResponseEventEnum.toolParams,
SseResponseEventEnum.toolResponse,
SseResponseEventEnum.updateVariables
];
// Forbid show detail
const detailEvent: Record<string, 1> = {
[SseResponseEventEnum.error]: 1,
[SseResponseEventEnum.flowNodeStatus]: 1,
[SseResponseEventEnum.flowResponses]: 1,
[SseResponseEventEnum.interactive]: 1,
[SseResponseEventEnum.toolCall]: 1,
[SseResponseEventEnum.toolParams]: 1,
[SseResponseEventEnum.toolResponse]: 1,
[SseResponseEventEnum.updateVariables]: 1
};
if (!detail && detailEvent[event]) return;
if (!detail && detailEvent.includes(event)) return;
if (
!showNodeStatus &&
(event === SseResponseEventEnum.flowNodeStatus ||
event === SseResponseEventEnum.toolCall ||
event === SseResponseEventEnum.toolParams ||
event === SseResponseEventEnum.toolResponse)
)
return;
// Forbid show running status
const statusEvent: Record<string, 1> = {
[SseResponseEventEnum.flowNodeStatus]: 1,
[SseResponseEventEnum.toolCall]: 1,
[SseResponseEventEnum.toolParams]: 1,
[SseResponseEventEnum.toolResponse]: 1
};
if (!showNodeStatus && statusEvent[event]) return;
responseWrite({
res,

View File

@@ -42,6 +42,7 @@ const OutLinkSchema = new Schema({
lastTime: {
type: Date
},
responseDetail: {
type: Boolean,
default: false
@@ -50,7 +51,7 @@ const OutLinkSchema = new Schema({
type: Boolean,
default: false
},
showCompleteQuote: {
showRawSource: {
type: Boolean,
default: false
},
@@ -70,6 +71,8 @@ const OutLinkSchema = new Schema({
type: String
}
},
// Third part app config
app: {
type: Object // could be FeishuAppType | WecomAppType | ...
},

View File

@@ -20,6 +20,7 @@
"official_account.edit_modal_title": "Edit WeChat Official Account Integration",
"official_account.name": "WeChat Official Account Integration",
"official_account.params": "WeChat Official Account Parameters",
"private_config": "Visibility configuration",
"publish_name": "Name",
"qpm_is_empty": "QPM cannot be empty",
"qpm_tips": "Maximum number of queries per minute per IP",

View File

@@ -28,7 +28,7 @@
"insert_input_guide,_some_data_already_exists": "有重复数据,已自动过滤,共插入 {{len}} 条数据",
"is_chatting": "正在聊天中...请等待结束",
"items": "条",
"module_runtime_and": "模块运行时间",
"module_runtime_and": "工作流总运行时间",
"multiple_AI_conversations": "多组 AI 对话",
"new_input_guide_lexicon": "新词库",
"no_workflow_response": "没有运行数据",

View File

@@ -20,10 +20,14 @@
"official_account.edit_modal_title": "编辑微信公众号接入",
"official_account.name": "微信公众号接入",
"official_account.params": "微信公众号参数",
"private_config": "可见度配置",
"publish_name": "名称",
"qpm_is_empty": "QPM 不能为空",
"qpm_tips": "每个 IP 每分钟最多提问多少次",
"quote_content": "知识库引用",
"request_address": "请求地址",
"show_node": "实时运行状态",
"show_origin_content": "查看来源原文",
"show_share_link_modal_title": "开始使用",
"token_auth": "身份验证",
"token_auth_tips": "身份校验服务器地址",
@@ -33,8 +37,5 @@
"wecom.bot_desc": "通过 API 直接接入企业微信机器人",
"wecom.create_modal_title": "创建企微机器人",
"wecom.edit_modal_title": "编辑企微机器人",
"wecom.title": "发布到企业微信机器人",
"show_node": "实时运行状态",
"quote_content": "引用内容",
"show_origin_content": "查看来源原文"
"wecom.title": "发布到企业微信机器人"
}