feat:聊天记录
This commit is contained in:
1 parent
94ee3201e2
commit
6ee9a5692b
64 files changed
+169
-40
No files matched your search
@@ -113,6 +113,10 @@ export enum DICT_TYPE {
|
||||
TERMINAL = 'terminal', // 终端
|
||||
DATE_INTERVAL = 'date_interval', // 数据间隔
|
||||
|
||||
// ========== CHAT 模块 ==========
|
||||
// 聊天消息状态
|
||||
CHAT_MSG_STATUS = 'chat_msg_status',
|
||||
|
||||
// ========== SYSTEM 模块 ==========
|
||||
SYSTEM_USER_SEX = 'system_user_sex',
|
||||
SYSTEM_MENU_TYPE = 'system_menu_type',
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
export const html2Escape = (strText: any) => {
|
||||
if (!strText) return ''
|
||||
return strText.replace(/[<>&"]/g, function(c) {
|
||||
return {
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'&': '&',
|
||||
'"': '"'
|
||||
} [c];
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
export const replaceURLWithHTMLLinks = (content) => {
|
||||
// 使用正则表达式匹配更广泛的URL格式(此正则由deepseek生成)
|
||||
const urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]|\bwww\.[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
|
||||
return content.replace(urlRegex, (url) => {
|
||||
// 如果URL不以http(s)://开头,则添加http://前缀
|
||||
if (!url.startsWith("http")) {
|
||||
url = "http://" + url;
|
||||
}
|
||||
return `<a href="${url}" target="_blank" style="color: #5359dc;text-decoration: underline;">${url}</a>`;
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user