mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-25 06:14:06 +00:00
Test parse cite and add tool call parallel (#4737)
* add quote response filter (#4727) * chatting * add quote response filter * add test * remove comment * perf: cite hidden * perf: format llm response * feat: comment * update default chunk size * update default chunk size --------- Co-authored-by: heheer <heheer@sealos.io>
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
[
|
||||
"测试的呀,第一个表格\n\n| 序号 | 姓名 | 年龄 | 职业 | 城市 |\n| --- | --- | --- | --- | --- |\n| 1 | 张三 | 25 | 工程师 | 北京 |\n| 2 | 李四 | 30 | 教师 | 上海 |\n| 3 | 王五 | 28 | 医生 | 广州 |\n| 6 | 周八 | 32 | 会计 | 成都 |\n| 4 | 赵六 | 35 | 律师 | 深圳 |\n| 5 | 孙七 | 27 | 设计师 | 杭州 |\n| 6 | 周八 | 32 | 会计 | 成都 |\n| 6 | 周八 | 32 | 会计 | 成都 |\n| 7 | 吴九 | 29 | 销售 | 武汉 |\n| 8 | 郑十 | 31 | 记者 | 南京 |\n| 9 | 刘一 | 33 | 建筑师 | 天津 |\n| 10 | 陈二 | 26 | 程序员 | 重庆 |\n| 1000 | 黄末 | 28 | 作家 | 厦门 |\n| 1001 | 杨一 | 34 | 程序员 | 厦门 |\n| 1002 | 杨二 | 34 | 程序员 | 厦门 |\n| 1003 | 杨三 | 34 | 程序员 | 厦门 |",
|
||||
"| 序号 | 姓名 | 年龄 | 职业 | 城市 |\n| --- | --- | --- | --- | --- |\n| 6 | 周八 | 32 | 会计 | 成都 |\n| 1004 | 杨四 | 34 | 程序员 | 厦门 |\n| 1005 | 杨五 | 34 | 程序员 | 厦门 |\n| 1000 | 黄末 | 28 | 作家 | 厦门 |\n| 1000 | 黄末 | 28 | 作家 | 厦门 |\n| 1000 | 黄末 | 28 | 作家 | 厦门 |\n| 9 | 刘一 | 33 | 建筑师 | 天津 |\n| 10 | 陈二 | 26 | 程序员 | 重庆 |\n| 1000 | 黄末 | 28 | 作家 | 厦门 |\n| 1001 | 杨一 | 34 | 程序员 | 厦门 |\n| 1002 | 杨二 | 34 | 程序员 | 厦门 |\n| 1003 | 杨三 | 34 | 程序员 | 厦门 |\n| 1004 | 杨四 | 34 | 程序员 | 厦门 |\n| 1005 | 杨五 | 34 | 程序员 | 厦门 |\n\n| 序号 | 姓名 | 年龄 | 职业 | 城市 |\n| --- | --- | --- | --- | --- |\n| 6 | 周八 | 32 | 会计 | 成都 |\n| 1000 | 黄末 | 28 | 作家 | 厦门 |\n| 1000 | 黄末 | 28 | 作家 | 厦门 |\n| 1000 | 黄末 | 28 | 作家 | 厦门 |",
|
||||
"这是第二段了,第二表格\n\n| 序号 | 姓名 | 年龄 | 职业 | 城市 |\n| --- | --- | --- | --- | --- |\n| 1 | 张三 | 25 | 工程师 | 北京 |\n| 6 | 周八 | 32 | 会计 | 成都 |\n| 2 | 李四 | 30 | 教师 | 上海 |\n| 3 | 王五 | 28 | 医生 | 广州 |\n| 4 | 赵六 | 35 | 律师 | 深圳 |\n| 5 | 孙七 | 27 | 设计师 | 杭州 |\n| 6 | 周八 | 32 | 会计 | 成都 |\n| 7 | 吴九 | 29 | 销售 | 武汉 |\n| 8 | 郑十 | 31 | 记者 | 南京 |\n| 9 | 刘一 | 33 | 建筑师 | 天津 |\n| 10 | 陈二 | 26 | 程序员 | 重庆 |\n| 10004 | 黄末 | 28 | 作家 | 厦门 |\n| 10013 | 杨一 | 34 | 程序员 | 厦门 |\n\n\n结束了\n\n| 序号22 | 姓名 | 年龄 | 职业 | 城市 |\n| --- | --- | --- | --- | --- |\n| 1 | 张三 | 25 | 工程师 | 北京 |\n| 2 | 李四 | 30 | 教师 | 上海 |\n| 3 | 王五 | 28 | 医生 | 广州 |\n| 4 | 赵六 | 35 | 律师 | 深圳 |\n| 5 | 孙七 | 27 | 设计师 | 杭州 |\n| 6 | 周八 | 32 | 会计 | 成都 |\n| 6 | 周八 | 32 | 会计 | 成都 |\n| 7 | 吴九 | 29 | 销售 | 武汉 |\n| 8 | 郑十 | 31 | 记者 | 南京 |\n| 9 | 刘一 | 33 | 建筑师 | 天津 |\n| 10 | 陈二 | 26 | 程序员 | 重庆 |\n| 10002 | 黄末 | 28 | 作家 | 厦门 |\n| 10012 | 杨一 | 34 | 程序员 | 厦门 |"
|
||||
]
|
@@ -0,0 +1,35 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { checkPasswordRule } from '@fastgpt/global/common/string/password';
|
||||
|
||||
describe('PasswordRule', () => {
|
||||
it('should be a valid password', () => {
|
||||
// Small password
|
||||
expect(checkPasswordRule('123A')).toBe(false);
|
||||
expect(checkPasswordRule('@ga21')).toBe(false);
|
||||
|
||||
// Test single type characters
|
||||
expect(checkPasswordRule('123456')).toBe(false);
|
||||
expect(checkPasswordRule('abcdef')).toBe(false); // only lowercase
|
||||
expect(checkPasswordRule('ABCDEF')).toBe(false); // only uppercase
|
||||
expect(checkPasswordRule('!@#$%^')).toBe(false); // only special chars
|
||||
|
||||
// Test two types combination
|
||||
expect(checkPasswordRule('abc123')).toBe(true); // lowercase + numbers
|
||||
expect(checkPasswordRule('abcABC')).toBe(true); // lowercase + uppercase
|
||||
expect(checkPasswordRule('abc!@#')).toBe(true); // lowercase + special chars
|
||||
expect(checkPasswordRule('ABC!@#')).toBe(true); // uppercase + special chars
|
||||
expect(checkPasswordRule('ABC123')).toBe(true); // uppercase + numbers
|
||||
expect(checkPasswordRule('123!@#')).toBe(true); // numbers + special chars
|
||||
expect(checkPasswordRule('!@123fa')).toBe(true); // numbers + special chars
|
||||
expect(checkPasswordRule('+2222()222')).toBe(true); // special chars + numbers
|
||||
expect(checkPasswordRule('_2222()-+=22')).toBe(true); // special chars + numbers
|
||||
|
||||
// Test three types combination
|
||||
expect(checkPasswordRule('abcABC123')).toBe(true); // lower + upper + numbers
|
||||
expect(checkPasswordRule('abc123!@#')).toBe(true); // lower + numbers + special
|
||||
expect(checkPasswordRule('abc!@#123')).toBe(true); // lower + special + numbers
|
||||
|
||||
// Test all four types
|
||||
expect(checkPasswordRule('abcABC123!@#')).toBe(true); // all types
|
||||
});
|
||||
});
|
@@ -1,6 +1,5 @@
|
||||
import { it, expect } from 'vitest'; // 必须显式导入
|
||||
import { splitText2Chunks } from '@fastgpt/global/common/string/textSplitter';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const simpleChunks = (chunks: string[]) => {
|
||||
return chunks.map((chunk) => chunk.replace(/\s+/g, ''));
|
||||
|
Reference in New Issue
Block a user