feat: 创建多智能体展示分支
- 包含会展策划智能体配置文件 - 包含项目文档和配置更新 - 准备多智能体协作功能展示
This commit is contained in:
36
data/智能开发/Agent/assets/javascript/tool.js
Executable file
36
data/智能开发/Agent/assets/javascript/tool.js
Executable file
@@ -0,0 +1,36 @@
|
||||
|
||||
function handleCode (code, isWeb) {
|
||||
if (isWeb) {
|
||||
return code;
|
||||
}
|
||||
// 要插入的滚动条样式
|
||||
const scrollbarStyle = `
|
||||
<style>
|
||||
::-webkit-scrollbar {
|
||||
width: 0px;
|
||||
}
|
||||
</style>
|
||||
`;
|
||||
|
||||
// 将样式插入到 <head> 标签内(如果存在 <head>)
|
||||
let modifiedHtml = code;
|
||||
if (/\s*<\/head\s*>/i.test(modifiedHtml)) {
|
||||
modifiedHtml = modifiedHtml.replace(/(\s*<\/head\s*>)/i, `${scrollbarStyle}$1`);
|
||||
} else {
|
||||
// 如果没有 <head>,直接插入到 <html> 之后
|
||||
modifiedHtml = modifiedHtml.replace('<html>', `<html>${scrollbarStyle}`);
|
||||
}
|
||||
return modifiedHtml
|
||||
}
|
||||
|
||||
|
||||
const useEventListener = (element, eventType, callback, useCapture = false) => {
|
||||
if (!element || !callback) return null;
|
||||
|
||||
const handler = (event) => callback(event);
|
||||
element.addEventListener(eventType, handler, useCapture);
|
||||
|
||||
return () => {
|
||||
element.removeEventListener(eventType, handler, useCapture);
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user