Singleshot Prompt Testing
<div class="ce-block" data-id="aCcFrT-LYZ" ><div class="ce-block__content" style="">
<h1 class="ce-header ce-header--left">Singleshot Prompt Testing & Optimization Skill</h1>
</div>
</div><div class="ce-block" data-id="LScbTy3Scr" >
<div class="ce-block__content" style="">
<h2 class="ce-header ce-header--left">Description</h2>
</div>
</div><div class="ce-block ce-block--focused" data-id="jwVk1FaWqm" >
<div class="ce-block__content">
<div class="ce-paragraph cdx-block ce-paragraph--left">Prompt cost testing with single shot</div>
</div>
</div><div class="ce-block" data-id="MhjXGaeb_I" >
<div class="ce-block__content" style="">
<h2 class="ce-header ce-header--left">Installation</h2>
</div>
</div><div class="ce-block ce-block--focused" data-id="xrAKkWuo3M" >
<div class="ce-block__content">
<div class="editorjs-codeFlask_Wrapper">
<div class="editorjs-codeFlask_Header">
<div class="editorjs-codeFlask_LangDisplay">javascript</div>
<button class="editorjs-codeFlask_CopyButton" title="复制代码" id="codeflask-copy-xrAKkWuo3M">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
<button class="editorjs-codeFlask_Toggle" id="codeflask-Toggle-xrAKkWuo3M">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
</div>
<div class="editorjs-codeFlask_ContentContainer">
<div class="editorjs-codeFlask_Editor" id="codeflask-xrAKkWuo3M" >
</div>
</div>
<div class="editorjs-codeFlask_BottomButtonContainer" id="codeflask-bottomBtn-xrAKkWuo3M">
<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="static/js/editorjs/tools/codeflask/codeflask150.min.js?L8J"></script>
<script type="application/javascript">
const editorElem1778072787A72YY = document.getElementById('codeflask-xrAKkWuo3M');
var isCollapsed1778072787A72YY = true;
const flask1778072787A72YY = new CodeFlask(editorElem1778072787A72YY, {
language: 'javascript',
lineNumbers: true,
styleParent: this.shadowRoot,
rtl: false,
readonly: true
});
var code1778072787A72YY = `brew tap vincentzhangz/singleshot
brew install singleshot`;
code1778072787A72YY = code1778072787A72YY.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
flask1778072787A72YY.addLanguage('javascript', Prism.languages['javascript']);
flask1778072787A72YY.onUpdate((code) => {
// do something with code here.
// this will trigger whenever the code
// in the editor changes.
// console.log(code)
});
// flask.updateCode('');
// This will also trigger .onUpdate()
flask1778072787A72YY.updateCode(code1778072787A72YY);
const currentCode1778072787A72YY = flask1778072787A72YY.getCode();
var coderow1778072787A72YY = parseInt('');
if (coderow1778072787A72YY === undefined || coderow1778072787A72YY !== coderow1778072787A72YY || coderow1778072787A72YY === 0) {
coderow1778072787A72YY = flask1778072787A72YY.lineNumber;
}
if (coderow1778072787A72YY < 20) {
editorElem1778072787A72YY.parentElement.style.height = '300px';
editorElem1778072787A72YY.style.height = '300px';
} else if (coderow1778072787A72YY >= 20) {
editorElem1778072787A72YY.parentElement.style.height = '500px';
editorElem1778072787A72YY.style.height = '500px';
}
//console.log({currentCode1778072787A72YY})
const copyBtn1778072787A72YY = document.getElementById('codeflask-copy-xrAKkWuo3M');
copyBtn1778072787A72YY.addEventListener('click', function() {
try {
// 先检查 Clipboard API 是否可用
if (navigator.clipboard && navigator.clipboard.writeText) {
// 使用 Clipboard API 复制代码
navigator.clipboard.writeText(code1778072787A72YY).then(function() {
// 复制成功提示
const originalText = copyBtn1778072787A72YY.innerHTML;
copyBtn1778072787A72YY.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
// 一段时间后恢复原文本
setTimeout(function() {
copyBtn1778072787A72YY.innerHTML = originalText;
}, 2000);
}).catch(function(err) {
// 复制失败处理
console.error('复制失败:', err);
// 降级方案:使用传统的复制方法
fallbackCopyTextToClipboard(code1778072787A72YY);
});
} else {
// Clipboard API 不可用时直接使用降级方案
fallbackCopyTextToClipboard(code1778072787A72YY);
}
// 提取降级方案为独立函数
function fallbackCopyTextToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
const originalText = copyBtn1778072787A72YY.innerHTML;
copyBtn1778072787A72YY.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
setTimeout(function() {
copyBtn1778072787A72YY.innerHTML = originalText;
}, 2000);
} catch (copyErr) {
console.error('传统复制方法也失败了:', copyErr);
} finally {
document.body.removeChild(textArea);
}
}
} catch (err) {
console.error('复制功能不可用:', err);
}
});
const bottomBtn1778072787A72YY = document.getElementById('codeflask-bottomBtn-xrAKkWuo3M');
const Toggle1778072787A72YY = document.getElementById('codeflask-Toggle-xrAKkWuo3M');
bottomBtn1778072787A72YY.addEventListener('click', function() {
if (isCollapsed1778072787A72YY) {
// 展开代码
isCollapsed1778072787A72YY = false;
const codeElement1778072787A72YY = editorElem1778072787A72YY.querySelector('.codeflask__code');
if (codeElement1778072787A72YY) {
const actualHeight1778072787A72YY = codeElement1778072787A72YY.scrollHeight + 20;
editorElem1778072787A72YY.parentElement.style.height = actualHeight1778072787A72YY + 'px';
editorElem1778072787A72YY.style.height = actualHeight1778072787A72YY + 'px';
}
bottomBtn1778072787A72YY.innerHTML = '<button class="editorjs-codeFlask_BottomToggle" title="折叠代码"><span class="toggle-icon">▲</span> 折叠</button>';
Toggle1778072787A72YY.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>';
} else {
// 折叠代码
isCollapsed1778072787A72YY = true;
if (coderow1778072787A72YY < 20) {
editorElem1778072787A72YY.parentElement.style.height = '300px';
editorElem1778072787A72YY.style.height = '300px';
} else if (coderow1778072787A72YY >= 20) {
editorElem1778072787A72YY.parentElement.style.height = '500px';
editorElem1778072787A72YY.style.height = '500px';
}
bottomBtn1778072787A72YY.innerHTML = '<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>';
Toggle1778072787A72YY.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>';
}
});
Toggle1778072787A72YY.addEventListener('click', function() {
bottomBtn1778072787A72YY.click();
});
</script><div class="ce-block ce-block--focused" data-id="uGan4RLJE7" >
<div class="ce-block__content">
<div class="ce-paragraph cdx-block ce-paragraph--left"> <span style="color: rgb(58, 58, 60); font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255);">Or: </span><code><mark style="background-color: rgb(255, 191, 0);">cargo install singleshot</mark></code></div>
</div>
</div><div class="ce-block" data-id="DqVZBRvceE" >
<div class="ce-block__content" style="">
<h2 class="ce-header ce-header--left">When to Use</h2>
</div>
</div><div class="ce-block ce-block--focused" data-id="xkwvgUnpEt" >
<div class="ce-block__content">
<ul class="cdx-list-unordered"><li class="cdx-list__item">Testing new prompts before openclaw implementation</li><li class="cdx-list__item">Benchmarking prompt variations for token efficiency</li><li class="cdx-list__item">Comparing model performance and costs</li><li class="cdx-list__item">Validating prompt outputs before production</li></ul>
</div>
</div><div class="ce-block" data-id="4YYaerTV73" >
<div class="ce-block__content" style="">
<h2 class="ce-header ce-header--left">Core Commands</h2>
</div>
</div><div class="ce-block ce-block--focused" data-id="q-dvyZNRFP" >
<div class="ce-block__content">
<div class="ce-paragraph cdx-block ce-paragraph--left">Always use<span> </span><code>-d</code><span> </span>(detail) and<span> </span><code>-r</code><span> </span>(report) flags for efficiency analysis:</div>
</div>
</div><div class="ce-block ce-block--focused" data-id="uNVTVueQIk" >
<div class="ce-block__content">
<div class="editorjs-codeFlask_Wrapper">
<div class="editorjs-codeFlask_Header">
<div class="editorjs-codeFlask_LangDisplay">javascript</div>
<button class="editorjs-codeFlask_CopyButton" title="复制代码" id="codeflask-copy-uNVTVueQIk">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
<button class="editorjs-codeFlask_Toggle" id="codeflask-Toggle-uNVTVueQIk">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
</div>
<div class="editorjs-codeFlask_ContentContainer">
<div class="editorjs-codeFlask_Editor" id="codeflask-uNVTVueQIk" >
</div>
</div>
<div class="editorjs-codeFlask_BottomButtonContainer" id="codeflask-bottomBtn-uNVTVueQIk">
<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="static/js/editorjs/tools/codeflask/codeflask150.min.js?L8J"></script>
<script type="application/javascript">
const editorElem1778072787FijL7 = document.getElementById('codeflask-uNVTVueQIk');
var isCollapsed1778072787FijL7 = true;
const flask1778072787FijL7 = new CodeFlask(editorElem1778072787FijL7, {
language: 'javascript',
lineNumbers: true,
styleParent: this.shadowRoot,
rtl: false,
readonly: true
});
var code1778072787FijL7 = `# Basic test with full metrics
singleshot chat -p "Your prompt" -P openai -d -r report.md
# Test with config file
singleshot chat -l config.md -d -r report.md
# Compare providers
singleshot chat -p "Test" -P openai -m gpt-4o-mini -d -r openai.md
singleshot chat -p "Test" -P anthropic -m claude-sonnet-4-20250514 -d -r anthropic.md
# Batch test variations
for config in *.md; do
singleshot chat -l "$config" -d -r "report-${config%.md}.md"
done`;
code1778072787FijL7 = code1778072787FijL7.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
flask1778072787FijL7.addLanguage('javascript', Prism.languages['javascript']);
flask1778072787FijL7.onUpdate((code) => {
// do something with code here.
// this will trigger whenever the code
// in the editor changes.
// console.log(code)
});
// flask.updateCode('');
// This will also trigger .onUpdate()
flask1778072787FijL7.updateCode(code1778072787FijL7);
const currentCode1778072787FijL7 = flask1778072787FijL7.getCode();
var coderow1778072787FijL7 = parseInt('');
if (coderow1778072787FijL7 === undefined || coderow1778072787FijL7 !== coderow1778072787FijL7 || coderow1778072787FijL7 === 0) {
coderow1778072787FijL7 = flask1778072787FijL7.lineNumber;
}
if (coderow1778072787FijL7 < 20) {
editorElem1778072787FijL7.parentElement.style.height = '300px';
editorElem1778072787FijL7.style.height = '300px';
} else if (coderow1778072787FijL7 >= 20) {
editorElem1778072787FijL7.parentElement.style.height = '500px';
editorElem1778072787FijL7.style.height = '500px';
}
//console.log({currentCode1778072787FijL7})
const copyBtn1778072787FijL7 = document.getElementById('codeflask-copy-uNVTVueQIk');
copyBtn1778072787FijL7.addEventListener('click', function() {
try {
// 先检查 Clipboard API 是否可用
if (navigator.clipboard && navigator.clipboard.writeText) {
// 使用 Clipboard API 复制代码
navigator.clipboard.writeText(code1778072787FijL7).then(function() {
// 复制成功提示
const originalText = copyBtn1778072787FijL7.innerHTML;
copyBtn1778072787FijL7.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
// 一段时间后恢复原文本
setTimeout(function() {
copyBtn1778072787FijL7.innerHTML = originalText;
}, 2000);
}).catch(function(err) {
// 复制失败处理
console.error('复制失败:', err);
// 降级方案:使用传统的复制方法
fallbackCopyTextToClipboard(code1778072787FijL7);
});
} else {
// Clipboard API 不可用时直接使用降级方案
fallbackCopyTextToClipboard(code1778072787FijL7);
}
// 提取降级方案为独立函数
function fallbackCopyTextToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
const originalText = copyBtn1778072787FijL7.innerHTML;
copyBtn1778072787FijL7.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
setTimeout(function() {
copyBtn1778072787FijL7.innerHTML = originalText;
}, 2000);
} catch (copyErr) {
console.error('传统复制方法也失败了:', copyErr);
} finally {
document.body.removeChild(textArea);
}
}
} catch (err) {
console.error('复制功能不可用:', err);
}
});
const bottomBtn1778072787FijL7 = document.getElementById('codeflask-bottomBtn-uNVTVueQIk');
const Toggle1778072787FijL7 = document.getElementById('codeflask-Toggle-uNVTVueQIk');
bottomBtn1778072787FijL7.addEventListener('click', function() {
if (isCollapsed1778072787FijL7) {
// 展开代码
isCollapsed1778072787FijL7 = false;
const codeElement1778072787FijL7 = editorElem1778072787FijL7.querySelector('.codeflask__code');
if (codeElement1778072787FijL7) {
const actualHeight1778072787FijL7 = codeElement1778072787FijL7.scrollHeight + 20;
editorElem1778072787FijL7.parentElement.style.height = actualHeight1778072787FijL7 + 'px';
editorElem1778072787FijL7.style.height = actualHeight1778072787FijL7 + 'px';
}
bottomBtn1778072787FijL7.innerHTML = '<button class="editorjs-codeFlask_BottomToggle" title="折叠代码"><span class="toggle-icon">▲</span> 折叠</button>';
Toggle1778072787FijL7.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>';
} else {
// 折叠代码
isCollapsed1778072787FijL7 = true;
if (coderow1778072787FijL7 < 20) {
editorElem1778072787FijL7.parentElement.style.height = '300px';
editorElem1778072787FijL7.style.height = '300px';
} else if (coderow1778072787FijL7 >= 20) {
editorElem1778072787FijL7.parentElement.style.height = '500px';
editorElem1778072787FijL7.style.height = '500px';
}
bottomBtn1778072787FijL7.innerHTML = '<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>';
Toggle1778072787FijL7.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>';
}
});
Toggle1778072787FijL7.addEventListener('click', function() {
bottomBtn1778072787FijL7.click();
});
</script><div class="ce-block" data-id="5KZDYzoL8X" >
<div class="ce-block__content" style="">
<h2 class="ce-header ce-header--left">Report Analysis Workflow</h2>
</div>
</div><div class="ce-block" data-id="M8Q1VueMvM" >
<div class="ce-block__content" style="">
<h3 class="ce-header ce-header--left">1. Generate Baseline</h3>
</div>
</div><div class="ce-block ce-block--focused" data-id="PHuuGRy4H_" >
<div class="ce-block__content">
<div class="editorjs-codeFlask_Wrapper">
<div class="editorjs-codeFlask_Header">
<div class="editorjs-codeFlask_LangDisplay">javascript</div>
<button class="editorjs-codeFlask_CopyButton" title="复制代码" id="codeflask-copy-PHuuGRy4H_">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
<button class="editorjs-codeFlask_Toggle" id="codeflask-Toggle-PHuuGRy4H_">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
</div>
<div class="editorjs-codeFlask_ContentContainer">
<div class="editorjs-codeFlask_Editor" id="codeflask-PHuuGRy4H_" >
</div>
</div>
<div class="editorjs-codeFlask_BottomButtonContainer" id="codeflask-bottomBtn-PHuuGRy4H_">
<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="static/js/editorjs/tools/codeflask/codeflask150.min.js?L8J"></script>
<script type="application/javascript">
const editorElem1778072787N2zPU = document.getElementById('codeflask-PHuuGRy4H_');
var isCollapsed1778072787N2zPU = true;
const flask1778072787N2zPU = new CodeFlask(editorElem1778072787N2zPU, {
language: 'javascript',
lineNumbers: true,
styleParent: this.shadowRoot,
rtl: false,
readonly: true
});
var code1778072787N2zPU = `singleshot chat -p "Your prompt" -P openai -d -r baseline.md
cat baseline.md`;
code1778072787N2zPU = code1778072787N2zPU.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
flask1778072787N2zPU.addLanguage('javascript', Prism.languages['javascript']);
flask1778072787N2zPU.onUpdate((code) => {
// do something with code here.
// this will trigger whenever the code
// in the editor changes.
// console.log(code)
});
// flask.updateCode('');
// This will also trigger .onUpdate()
flask1778072787N2zPU.updateCode(code1778072787N2zPU);
const currentCode1778072787N2zPU = flask1778072787N2zPU.getCode();
var coderow1778072787N2zPU = parseInt('');
if (coderow1778072787N2zPU === undefined || coderow1778072787N2zPU !== coderow1778072787N2zPU || coderow1778072787N2zPU === 0) {
coderow1778072787N2zPU = flask1778072787N2zPU.lineNumber;
}
if (coderow1778072787N2zPU < 20) {
editorElem1778072787N2zPU.parentElement.style.height = '300px';
editorElem1778072787N2zPU.style.height = '300px';
} else if (coderow1778072787N2zPU >= 20) {
editorElem1778072787N2zPU.parentElement.style.height = '500px';
editorElem1778072787N2zPU.style.height = '500px';
}
//console.log({currentCode1778072787N2zPU})
const copyBtn1778072787N2zPU = document.getElementById('codeflask-copy-PHuuGRy4H_');
copyBtn1778072787N2zPU.addEventListener('click', function() {
try {
// 先检查 Clipboard API 是否可用
if (navigator.clipboard && navigator.clipboard.writeText) {
// 使用 Clipboard API 复制代码
navigator.clipboard.writeText(code1778072787N2zPU).then(function() {
// 复制成功提示
const originalText = copyBtn1778072787N2zPU.innerHTML;
copyBtn1778072787N2zPU.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
// 一段时间后恢复原文本
setTimeout(function() {
copyBtn1778072787N2zPU.innerHTML = originalText;
}, 2000);
}).catch(function(err) {
// 复制失败处理
console.error('复制失败:', err);
// 降级方案:使用传统的复制方法
fallbackCopyTextToClipboard(code1778072787N2zPU);
});
} else {
// Clipboard API 不可用时直接使用降级方案
fallbackCopyTextToClipboard(code1778072787N2zPU);
}
// 提取降级方案为独立函数
function fallbackCopyTextToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
const originalText = copyBtn1778072787N2zPU.innerHTML;
copyBtn1778072787N2zPU.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
setTimeout(function() {
copyBtn1778072787N2zPU.innerHTML = originalText;
}, 2000);
} catch (copyErr) {
console.error('传统复制方法也失败了:', copyErr);
} finally {
document.body.removeChild(textArea);
}
}
} catch (err) {
console.error('复制功能不可用:', err);
}
});
const bottomBtn1778072787N2zPU = document.getElementById('codeflask-bottomBtn-PHuuGRy4H_');
const Toggle1778072787N2zPU = document.getElementById('codeflask-Toggle-PHuuGRy4H_');
bottomBtn1778072787N2zPU.addEventListener('click', function() {
if (isCollapsed1778072787N2zPU) {
// 展开代码
isCollapsed1778072787N2zPU = false;
const codeElement1778072787N2zPU = editorElem1778072787N2zPU.querySelector('.codeflask__code');
if (codeElement1778072787N2zPU) {
const actualHeight1778072787N2zPU = codeElement1778072787N2zPU.scrollHeight + 20;
editorElem1778072787N2zPU.parentElement.style.height = actualHeight1778072787N2zPU + 'px';
editorElem1778072787N2zPU.style.height = actualHeight1778072787N2zPU + 'px';
}
bottomBtn1778072787N2zPU.innerHTML = '<button class="editorjs-codeFlask_BottomToggle" title="折叠代码"><span class="toggle-icon">▲</span> 折叠</button>';
Toggle1778072787N2zPU.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>';
} else {
// 折叠代码
isCollapsed1778072787N2zPU = true;
if (coderow1778072787N2zPU < 20) {
editorElem1778072787N2zPU.parentElement.style.height = '300px';
editorElem1778072787N2zPU.style.height = '300px';
} else if (coderow1778072787N2zPU >= 20) {
editorElem1778072787N2zPU.parentElement.style.height = '500px';
editorElem1778072787N2zPU.style.height = '500px';
}
bottomBtn1778072787N2zPU.innerHTML = '<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>';
Toggle1778072787N2zPU.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>';
}
});
Toggle1778072787N2zPU.addEventListener('click', function() {
bottomBtn1778072787N2zPU.click();
});
</script><div class="ce-block" data-id="BAVhskx8xu" >
<div class="ce-block__content" style="">
<h3 class="ce-header ce-header--left">2. Optimize & Compare</h3>
</div>
</div><div class="ce-block ce-block--focused" data-id="weSrosQ7Nz" >
<div class="ce-block__content">
<div class="editorjs-codeFlask_Wrapper">
<div class="editorjs-codeFlask_Header">
<div class="editorjs-codeFlask_LangDisplay">javascript</div>
<button class="editorjs-codeFlask_CopyButton" title="复制代码" id="codeflask-copy-weSrosQ7Nz">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
<button class="editorjs-codeFlask_Toggle" id="codeflask-Toggle-weSrosQ7Nz">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
</div>
<div class="editorjs-codeFlask_ContentContainer">
<div class="editorjs-codeFlask_Editor" id="codeflask-weSrosQ7Nz" >
</div>
</div>
<div class="editorjs-codeFlask_BottomButtonContainer" id="codeflask-bottomBtn-weSrosQ7Nz">
<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="static/js/editorjs/tools/codeflask/codeflask150.min.js?L8J"></script>
<script type="application/javascript">
const editorElem1778072787La4iS = document.getElementById('codeflask-weSrosQ7Nz');
var isCollapsed1778072787La4iS = true;
const flask1778072787La4iS = new CodeFlask(editorElem1778072787La4iS, {
language: 'javascript',
lineNumbers: true,
styleParent: this.shadowRoot,
rtl: false,
readonly: true
});
var code1778072787La4iS = `# Create optimized version, test, and compare
cat > optimized.md << 'EOF'
---provider---
openai
---model---
gpt-4o-mini
---max_tokens---
200
---system---
Expert. Be concise.
---prompt---
Your optimized prompt
EOF
singleshot chat -l optimized.md -d -r optimized-report.md
# Compare metrics
echo "Baseline:" && grep -E "(Tokens|Cost)" baseline.md
echo "Optimized:" && grep -E "(Tokens|Cost)" optimized-report.md`;
code1778072787La4iS = code1778072787La4iS.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
flask1778072787La4iS.addLanguage('javascript', Prism.languages['javascript']);
flask1778072787La4iS.onUpdate((code) => {
// do something with code here.
// this will trigger whenever the code
// in the editor changes.
// console.log(code)
});
// flask.updateCode('');
// This will also trigger .onUpdate()
flask1778072787La4iS.updateCode(code1778072787La4iS);
const currentCode1778072787La4iS = flask1778072787La4iS.getCode();
var coderow1778072787La4iS = parseInt('');
if (coderow1778072787La4iS === undefined || coderow1778072787La4iS !== coderow1778072787La4iS || coderow1778072787La4iS === 0) {
coderow1778072787La4iS = flask1778072787La4iS.lineNumber;
}
if (coderow1778072787La4iS < 20) {
editorElem1778072787La4iS.parentElement.style.height = '300px';
editorElem1778072787La4iS.style.height = '300px';
} else if (coderow1778072787La4iS >= 20) {
editorElem1778072787La4iS.parentElement.style.height = '500px';
editorElem1778072787La4iS.style.height = '500px';
}
//console.log({currentCode1778072787La4iS})
const copyBtn1778072787La4iS = document.getElementById('codeflask-copy-weSrosQ7Nz');
copyBtn1778072787La4iS.addEventListener('click', function() {
try {
// 先检查 Clipboard API 是否可用
if (navigator.clipboard && navigator.clipboard.writeText) {
// 使用 Clipboard API 复制代码
navigator.clipboard.writeText(code1778072787La4iS).then(function() {
// 复制成功提示
const originalText = copyBtn1778072787La4iS.innerHTML;
copyBtn1778072787La4iS.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
// 一段时间后恢复原文本
setTimeout(function() {
copyBtn1778072787La4iS.innerHTML = originalText;
}, 2000);
}).catch(function(err) {
// 复制失败处理
console.error('复制失败:', err);
// 降级方案:使用传统的复制方法
fallbackCopyTextToClipboard(code1778072787La4iS);
});
} else {
// Clipboard API 不可用时直接使用降级方案
fallbackCopyTextToClipboard(code1778072787La4iS);
}
// 提取降级方案为独立函数
function fallbackCopyTextToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
const originalText = copyBtn1778072787La4iS.innerHTML;
copyBtn1778072787La4iS.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
setTimeout(function() {
copyBtn1778072787La4iS.innerHTML = originalText;
}, 2000);
} catch (copyErr) {
console.error('传统复制方法也失败了:', copyErr);
} finally {
document.body.removeChild(textArea);
}
}
} catch (err) {
console.error('复制功能不可用:', err);
}
});
const bottomBtn1778072787La4iS = document.getElementById('codeflask-bottomBtn-weSrosQ7Nz');
const Toggle1778072787La4iS = document.getElementById('codeflask-Toggle-weSrosQ7Nz');
bottomBtn1778072787La4iS.addEventListener('click', function() {
if (isCollapsed1778072787La4iS) {
// 展开代码
isCollapsed1778072787La4iS = false;
const codeElement1778072787La4iS = editorElem1778072787La4iS.querySelector('.codeflask__code');
if (codeElement1778072787La4iS) {
const actualHeight1778072787La4iS = codeElement1778072787La4iS.scrollHeight + 20;
editorElem1778072787La4iS.parentElement.style.height = actualHeight1778072787La4iS + 'px';
editorElem1778072787La4iS.style.height = actualHeight1778072787La4iS + 'px';
}
bottomBtn1778072787La4iS.innerHTML = '<button class="editorjs-codeFlask_BottomToggle" title="折叠代码"><span class="toggle-icon">▲</span> 折叠</button>';
Toggle1778072787La4iS.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>';
} else {
// 折叠代码
isCollapsed1778072787La4iS = true;
if (coderow1778072787La4iS < 20) {
editorElem1778072787La4iS.parentElement.style.height = '300px';
editorElem1778072787La4iS.style.height = '300px';
} else if (coderow1778072787La4iS >= 20) {
editorElem1778072787La4iS.parentElement.style.height = '500px';
editorElem1778072787La4iS.style.height = '500px';
}
bottomBtn1778072787La4iS.innerHTML = '<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>';
Toggle1778072787La4iS.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>';
}
});
Toggle1778072787La4iS.addEventListener('click', function() {
bottomBtn1778072787La4iS.click();
});
</script><div class="ce-block" data-id="EirI378u5g" >
<div class="ce-block__content" style="">
<h2 class="ce-header ce-header--left">Report Metrics</h2>
</div>
</div><div class="ce-block ce-block--focused" data-id="RV7n62uiJ1" >
<div class="ce-block__content">
<div class="ce-paragraph cdx-block ce-paragraph--left">Reports contain:</div>
</div>
</div><div class="ce-block ce-block--focused" data-id="Vw2pL_eg_V" >
<div class="ce-block__content">
<div class="editorjs-codeFlask_Wrapper">
<div class="editorjs-codeFlask_Header">
<div class="editorjs-codeFlask_LangDisplay">javascript</div>
<button class="editorjs-codeFlask_CopyButton" title="复制代码" id="codeflask-copy-Vw2pL_eg_V">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
<button class="editorjs-codeFlask_Toggle" id="codeflask-Toggle-Vw2pL_eg_V">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
</div>
<div class="editorjs-codeFlask_ContentContainer">
<div class="editorjs-codeFlask_Editor" id="codeflask-Vw2pL_eg_V" >
</div>
</div>
<div class="editorjs-codeFlask_BottomButtonContainer" id="codeflask-bottomBtn-Vw2pL_eg_V">
<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="static/js/editorjs/tools/codeflask/codeflask150.min.js?L8J"></script>
<script type="application/javascript">
const editorElem1778072787URm23 = document.getElementById('codeflask-Vw2pL_eg_V');
var isCollapsed1778072787URm23 = true;
const flask1778072787URm23 = new CodeFlask(editorElem1778072787URm23, {
language: 'javascript',
lineNumbers: true,
styleParent: this.shadowRoot,
rtl: false,
readonly: true
});
var code1778072787URm23 = `## Token Usage
- Input Tokens: 245
- Output Tokens: 180
- Total Tokens: 425
## Cost (estimated)
- Input Cost: $0.00003675
- Output Cost: $0.000108
- Total Cost: $0.00014475
## Timing
- Time to First Token: 0.45s
- Total Time: 1.23s`;
code1778072787URm23 = code1778072787URm23.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
flask1778072787URm23.addLanguage('javascript', Prism.languages['javascript']);
flask1778072787URm23.onUpdate((code) => {
// do something with code here.
// this will trigger whenever the code
// in the editor changes.
// console.log(code)
});
// flask.updateCode('');
// This will also trigger .onUpdate()
flask1778072787URm23.updateCode(code1778072787URm23);
const currentCode1778072787URm23 = flask1778072787URm23.getCode();
var coderow1778072787URm23 = parseInt('');
if (coderow1778072787URm23 === undefined || coderow1778072787URm23 !== coderow1778072787URm23 || coderow1778072787URm23 === 0) {
coderow1778072787URm23 = flask1778072787URm23.lineNumber;
}
if (coderow1778072787URm23 < 20) {
editorElem1778072787URm23.parentElement.style.height = '300px';
editorElem1778072787URm23.style.height = '300px';
} else if (coderow1778072787URm23 >= 20) {
editorElem1778072787URm23.parentElement.style.height = '500px';
editorElem1778072787URm23.style.height = '500px';
}
//console.log({currentCode1778072787URm23})
const copyBtn1778072787URm23 = document.getElementById('codeflask-copy-Vw2pL_eg_V');
copyBtn1778072787URm23.addEventListener('click', function() {
try {
// 先检查 Clipboard API 是否可用
if (navigator.clipboard && navigator.clipboard.writeText) {
// 使用 Clipboard API 复制代码
navigator.clipboard.writeText(code1778072787URm23).then(function() {
// 复制成功提示
const originalText = copyBtn1778072787URm23.innerHTML;
copyBtn1778072787URm23.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
// 一段时间后恢复原文本
setTimeout(function() {
copyBtn1778072787URm23.innerHTML = originalText;
}, 2000);
}).catch(function(err) {
// 复制失败处理
console.error('复制失败:', err);
// 降级方案:使用传统的复制方法
fallbackCopyTextToClipboard(code1778072787URm23);
});
} else {
// Clipboard API 不可用时直接使用降级方案
fallbackCopyTextToClipboard(code1778072787URm23);
}
// 提取降级方案为独立函数
function fallbackCopyTextToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
const originalText = copyBtn1778072787URm23.innerHTML;
copyBtn1778072787URm23.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
setTimeout(function() {
copyBtn1778072787URm23.innerHTML = originalText;
}, 2000);
} catch (copyErr) {
console.error('传统复制方法也失败了:', copyErr);
} finally {
document.body.removeChild(textArea);
}
}
} catch (err) {
console.error('复制功能不可用:', err);
}
});
const bottomBtn1778072787URm23 = document.getElementById('codeflask-bottomBtn-Vw2pL_eg_V');
const Toggle1778072787URm23 = document.getElementById('codeflask-Toggle-Vw2pL_eg_V');
bottomBtn1778072787URm23.addEventListener('click', function() {
if (isCollapsed1778072787URm23) {
// 展开代码
isCollapsed1778072787URm23 = false;
const codeElement1778072787URm23 = editorElem1778072787URm23.querySelector('.codeflask__code');
if (codeElement1778072787URm23) {
const actualHeight1778072787URm23 = codeElement1778072787URm23.scrollHeight + 20;
editorElem1778072787URm23.parentElement.style.height = actualHeight1778072787URm23 + 'px';
editorElem1778072787URm23.style.height = actualHeight1778072787URm23 + 'px';
}
bottomBtn1778072787URm23.innerHTML = '<button class="editorjs-codeFlask_BottomToggle" title="折叠代码"><span class="toggle-icon">▲</span> 折叠</button>';
Toggle1778072787URm23.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>';
} else {
// 折叠代码
isCollapsed1778072787URm23 = true;
if (coderow1778072787URm23 < 20) {
editorElem1778072787URm23.parentElement.style.height = '300px';
editorElem1778072787URm23.style.height = '300px';
} else if (coderow1778072787URm23 >= 20) {
editorElem1778072787URm23.parentElement.style.height = '500px';
editorElem1778072787URm23.style.height = '500px';
}
bottomBtn1778072787URm23.innerHTML = '<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>';
Toggle1778072787URm23.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>';
}
});
Toggle1778072787URm23.addEventListener('click', function() {
bottomBtn1778072787URm23.click();
});
</script><div class="ce-block" data-id="iJxCby0GIN" >
<div class="ce-block__content" style="">
<h2 class="ce-header ce-header--left">Optimization Strategies</h2>
</div>
</div><div class="ce-block ce-block--focused" data-id="QdyJcLl0bB" >
<div class="ce-block__content">
<ol class="cdx-list-ordered" style="list-style-type:none; margin-left: -15px;"><li class="cdx-list__item">1. Test with cheaper models first:</li></ol>
</div>
</div><div class="ce-block ce-block--focused" data-id="_SY3MSresf" >
<div class="ce-block__content">
<div class="editorjs-codeFlask_Wrapper">
<div class="editorjs-codeFlask_Header">
<div class="editorjs-codeFlask_LangDisplay">javascript</div>
<button class="editorjs-codeFlask_CopyButton" title="复制代码" id="codeflask-copy-_SY3MSresf">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
<button class="editorjs-codeFlask_Toggle" id="codeflask-Toggle-_SY3MSresf">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
</div>
<div class="editorjs-codeFlask_ContentContainer">
<div class="editorjs-codeFlask_Editor" id="codeflask-_SY3MSresf" >
</div>
</div>
<div class="editorjs-codeFlask_BottomButtonContainer" id="codeflask-bottomBtn-_SY3MSresf">
<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="static/js/editorjs/tools/codeflask/codeflask150.min.js?L8J"></script>
<script type="application/javascript">
const editorElem1778072787O1mNK = document.getElementById('codeflask-_SY3MSresf');
var isCollapsed1778072787O1mNK = true;
const flask1778072787O1mNK = new CodeFlask(editorElem1778072787O1mNK, {
language: 'javascript',
lineNumbers: true,
styleParent: this.shadowRoot,
rtl: false,
readonly: true
});
var code1778072787O1mNK = `singleshot chat -p "Test" -P openai -m gpt-4o-mini -d -r report.md`;
code1778072787O1mNK = code1778072787O1mNK.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
flask1778072787O1mNK.addLanguage('javascript', Prism.languages['javascript']);
flask1778072787O1mNK.onUpdate((code) => {
// do something with code here.
// this will trigger whenever the code
// in the editor changes.
// console.log(code)
});
// flask.updateCode('');
// This will also trigger .onUpdate()
flask1778072787O1mNK.updateCode(code1778072787O1mNK);
const currentCode1778072787O1mNK = flask1778072787O1mNK.getCode();
var coderow1778072787O1mNK = parseInt('');
if (coderow1778072787O1mNK === undefined || coderow1778072787O1mNK !== coderow1778072787O1mNK || coderow1778072787O1mNK === 0) {
coderow1778072787O1mNK = flask1778072787O1mNK.lineNumber;
}
if (coderow1778072787O1mNK < 20) {
editorElem1778072787O1mNK.parentElement.style.height = '300px';
editorElem1778072787O1mNK.style.height = '300px';
} else if (coderow1778072787O1mNK >= 20) {
editorElem1778072787O1mNK.parentElement.style.height = '500px';
editorElem1778072787O1mNK.style.height = '500px';
}
//console.log({currentCode1778072787O1mNK})
const copyBtn1778072787O1mNK = document.getElementById('codeflask-copy-_SY3MSresf');
copyBtn1778072787O1mNK.addEventListener('click', function() {
try {
// 先检查 Clipboard API 是否可用
if (navigator.clipboard && navigator.clipboard.writeText) {
// 使用 Clipboard API 复制代码
navigator.clipboard.writeText(code1778072787O1mNK).then(function() {
// 复制成功提示
const originalText = copyBtn1778072787O1mNK.innerHTML;
copyBtn1778072787O1mNK.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
// 一段时间后恢复原文本
setTimeout(function() {
copyBtn1778072787O1mNK.innerHTML = originalText;
}, 2000);
}).catch(function(err) {
// 复制失败处理
console.error('复制失败:', err);
// 降级方案:使用传统的复制方法
fallbackCopyTextToClipboard(code1778072787O1mNK);
});
} else {
// Clipboard API 不可用时直接使用降级方案
fallbackCopyTextToClipboard(code1778072787O1mNK);
}
// 提取降级方案为独立函数
function fallbackCopyTextToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
const originalText = copyBtn1778072787O1mNK.innerHTML;
copyBtn1778072787O1mNK.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
setTimeout(function() {
copyBtn1778072787O1mNK.innerHTML = originalText;
}, 2000);
} catch (copyErr) {
console.error('传统复制方法也失败了:', copyErr);
} finally {
document.body.removeChild(textArea);
}
}
} catch (err) {
console.error('复制功能不可用:', err);
}
});
const bottomBtn1778072787O1mNK = document.getElementById('codeflask-bottomBtn-_SY3MSresf');
const Toggle1778072787O1mNK = document.getElementById('codeflask-Toggle-_SY3MSresf');
bottomBtn1778072787O1mNK.addEventListener('click', function() {
if (isCollapsed1778072787O1mNK) {
// 展开代码
isCollapsed1778072787O1mNK = false;
const codeElement1778072787O1mNK = editorElem1778072787O1mNK.querySelector('.codeflask__code');
if (codeElement1778072787O1mNK) {
const actualHeight1778072787O1mNK = codeElement1778072787O1mNK.scrollHeight + 20;
editorElem1778072787O1mNK.parentElement.style.height = actualHeight1778072787O1mNK + 'px';
editorElem1778072787O1mNK.style.height = actualHeight1778072787O1mNK + 'px';
}
bottomBtn1778072787O1mNK.innerHTML = '<button class="editorjs-codeFlask_BottomToggle" title="折叠代码"><span class="toggle-icon">▲</span> 折叠</button>';
Toggle1778072787O1mNK.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>';
} else {
// 折叠代码
isCollapsed1778072787O1mNK = true;
if (coderow1778072787O1mNK < 20) {
editorElem1778072787O1mNK.parentElement.style.height = '300px';
editorElem1778072787O1mNK.style.height = '300px';
} else if (coderow1778072787O1mNK >= 20) {
editorElem1778072787O1mNK.parentElement.style.height = '500px';
editorElem1778072787O1mNK.style.height = '500px';
}
bottomBtn1778072787O1mNK.innerHTML = '<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>';
Toggle1778072787O1mNK.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>';
}
});
Toggle1778072787O1mNK.addEventListener('click', function() {
bottomBtn1778072787O1mNK.click();
});
</script><div class="ce-block ce-block--focused" data-id="s78stlcpmZ" >
<div class="ce-block__content">
<div class="ce-paragraph cdx-block ce-paragraph--left">Reduce tokens:
</div>
</div>
</div><div class="ce-block ce-block--focused" data-id="b8GrjuS4md" >
<div class="ce-block__content">
<ul class="cdx-list-unordered"><li class="cdx-list__item">Shorten system prompts</li><li class="cdx-list__item">Use<span> </span><code>--max-tokens</code><span> </span>to limit output</li><li class="cdx-list__item">Add "be concise" to system prompt</li></ul>
</div>
</div><div class="ce-block ce-block--focused" data-id="vHQLQJAfzh" >
<div class="ce-block__content">
<div class="ce-paragraph cdx-block ce-paragraph--left">Test locally (free):
</div>
</div>
</div><div class="ce-block ce-block--focused" data-id="qrW5K_xhQI" >
<div class="ce-block__content">
<div class="editorjs-codeFlask_Wrapper">
<div class="editorjs-codeFlask_Header">
<div class="editorjs-codeFlask_LangDisplay">javascript</div>
<button class="editorjs-codeFlask_CopyButton" title="复制代码" id="codeflask-copy-qrW5K_xhQI">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
<button class="editorjs-codeFlask_Toggle" id="codeflask-Toggle-qrW5K_xhQI">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
</div>
<div class="editorjs-codeFlask_ContentContainer">
<div class="editorjs-codeFlask_Editor" id="codeflask-qrW5K_xhQI" >
</div>
</div>
<div class="editorjs-codeFlask_BottomButtonContainer" id="codeflask-bottomBtn-qrW5K_xhQI">
<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="static/js/editorjs/tools/codeflask/codeflask150.min.js?L8J"></script>
<script type="application/javascript">
const editorElem1778072787xBbd5 = document.getElementById('codeflask-qrW5K_xhQI');
var isCollapsed1778072787xBbd5 = true;
const flask1778072787xBbd5 = new CodeFlask(editorElem1778072787xBbd5, {
language: 'javascript',
lineNumbers: true,
styleParent: this.shadowRoot,
rtl: false,
readonly: true
});
var code1778072787xBbd5 = `singleshot chat -p "Test" -P ollama -m llama3.2 -d -r report.md`;
code1778072787xBbd5 = code1778072787xBbd5.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
flask1778072787xBbd5.addLanguage('javascript', Prism.languages['javascript']);
flask1778072787xBbd5.onUpdate((code) => {
// do something with code here.
// this will trigger whenever the code
// in the editor changes.
// console.log(code)
});
// flask.updateCode('');
// This will also trigger .onUpdate()
flask1778072787xBbd5.updateCode(code1778072787xBbd5);
const currentCode1778072787xBbd5 = flask1778072787xBbd5.getCode();
var coderow1778072787xBbd5 = parseInt('');
if (coderow1778072787xBbd5 === undefined || coderow1778072787xBbd5 !== coderow1778072787xBbd5 || coderow1778072787xBbd5 === 0) {
coderow1778072787xBbd5 = flask1778072787xBbd5.lineNumber;
}
if (coderow1778072787xBbd5 < 20) {
editorElem1778072787xBbd5.parentElement.style.height = '300px';
editorElem1778072787xBbd5.style.height = '300px';
} else if (coderow1778072787xBbd5 >= 20) {
editorElem1778072787xBbd5.parentElement.style.height = '500px';
editorElem1778072787xBbd5.style.height = '500px';
}
//console.log({currentCode1778072787xBbd5})
const copyBtn1778072787xBbd5 = document.getElementById('codeflask-copy-qrW5K_xhQI');
copyBtn1778072787xBbd5.addEventListener('click', function() {
try {
// 先检查 Clipboard API 是否可用
if (navigator.clipboard && navigator.clipboard.writeText) {
// 使用 Clipboard API 复制代码
navigator.clipboard.writeText(code1778072787xBbd5).then(function() {
// 复制成功提示
const originalText = copyBtn1778072787xBbd5.innerHTML;
copyBtn1778072787xBbd5.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
// 一段时间后恢复原文本
setTimeout(function() {
copyBtn1778072787xBbd5.innerHTML = originalText;
}, 2000);
}).catch(function(err) {
// 复制失败处理
console.error('复制失败:', err);
// 降级方案:使用传统的复制方法
fallbackCopyTextToClipboard(code1778072787xBbd5);
});
} else {
// Clipboard API 不可用时直接使用降级方案
fallbackCopyTextToClipboard(code1778072787xBbd5);
}
// 提取降级方案为独立函数
function fallbackCopyTextToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
const originalText = copyBtn1778072787xBbd5.innerHTML;
copyBtn1778072787xBbd5.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
setTimeout(function() {
copyBtn1778072787xBbd5.innerHTML = originalText;
}, 2000);
} catch (copyErr) {
console.error('传统复制方法也失败了:', copyErr);
} finally {
document.body.removeChild(textArea);
}
}
} catch (err) {
console.error('复制功能不可用:', err);
}
});
const bottomBtn1778072787xBbd5 = document.getElementById('codeflask-bottomBtn-qrW5K_xhQI');
const Toggle1778072787xBbd5 = document.getElementById('codeflask-Toggle-qrW5K_xhQI');
bottomBtn1778072787xBbd5.addEventListener('click', function() {
if (isCollapsed1778072787xBbd5) {
// 展开代码
isCollapsed1778072787xBbd5 = false;
const codeElement1778072787xBbd5 = editorElem1778072787xBbd5.querySelector('.codeflask__code');
if (codeElement1778072787xBbd5) {
const actualHeight1778072787xBbd5 = codeElement1778072787xBbd5.scrollHeight + 20;
editorElem1778072787xBbd5.parentElement.style.height = actualHeight1778072787xBbd5 + 'px';
editorElem1778072787xBbd5.style.height = actualHeight1778072787xBbd5 + 'px';
}
bottomBtn1778072787xBbd5.innerHTML = '<button class="editorjs-codeFlask_BottomToggle" title="折叠代码"><span class="toggle-icon">▲</span> 折叠</button>';
Toggle1778072787xBbd5.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>';
} else {
// 折叠代码
isCollapsed1778072787xBbd5 = true;
if (coderow1778072787xBbd5 < 20) {
editorElem1778072787xBbd5.parentElement.style.height = '300px';
editorElem1778072787xBbd5.style.height = '300px';
} else if (coderow1778072787xBbd5 >= 20) {
editorElem1778072787xBbd5.parentElement.style.height = '500px';
editorElem1778072787xBbd5.style.height = '500px';
}
bottomBtn1778072787xBbd5.innerHTML = '<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>';
Toggle1778072787xBbd5.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>';
}
});
Toggle1778072787xBbd5.addEventListener('click', function() {
bottomBtn1778072787xBbd5.click();
});
</script><div class="ce-block" data-id="71tPcnLe7P" >
<div class="ce-block__content" style="">
<h2 class="ce-header ce-header--left">Example: Full Optimization</h2>
</div>
</div><div class="ce-block ce-block--focused" data-id="mPa1gN99yt" >
<div class="ce-block__content">
<div class="editorjs-codeFlask_Wrapper">
<div class="editorjs-codeFlask_Header">
<div class="editorjs-codeFlask_LangDisplay">javascript</div>
<button class="editorjs-codeFlask_CopyButton" title="复制代码" id="codeflask-copy-mPa1gN99yt">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
<button class="editorjs-codeFlask_Toggle" id="codeflask-Toggle-mPa1gN99yt">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
</div>
<div class="editorjs-codeFlask_ContentContainer">
<div class="editorjs-codeFlask_Editor" id="codeflask-mPa1gN99yt" >
</div>
</div>
<div class="editorjs-codeFlask_BottomButtonContainer" id="codeflask-bottomBtn-mPa1gN99yt">
<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="static/js/editorjs/tools/codeflask/codeflask150.min.js?L8J"></script>
<script type="application/javascript">
const editorElem1778072787npBl7 = document.getElementById('codeflask-mPa1gN99yt');
var isCollapsed1778072787npBl7 = true;
const flask1778072787npBl7 = new CodeFlask(editorElem1778072787npBl7, {
language: 'javascript',
lineNumbers: true,
styleParent: this.shadowRoot,
rtl: false,
readonly: true
});
var code1778072787npBl7 = `# Step 1: Baseline (verbose)
singleshot chat \
-p "How do I write a Rust function to add two numbers?" \
-s "You are an expert Rust programmer with 10 years experience" \
-P openai -d -r v1.md
# Step 2: Read metrics
cat v1.md
# Expected: ~130 input tokens, ~400 output tokens
# Step 3: Optimized version
singleshot chat \
-p "Rust function: add(a: i32, b: i32) -> i32" \
-s "Rust expert. Code only." \
-P openai --max-tokens 100 -d -r v2.md
# Step 4: Compare
echo "=== COMPARISON ==="
grep "Total Cost" v1.md v2.md
grep "Total Tokens" v1.md v2.md`;
code1778072787npBl7 = code1778072787npBl7.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
flask1778072787npBl7.addLanguage('javascript', Prism.languages['javascript']);
flask1778072787npBl7.onUpdate((code) => {
// do something with code here.
// this will trigger whenever the code
// in the editor changes.
// console.log(code)
});
// flask.updateCode('');
// This will also trigger .onUpdate()
flask1778072787npBl7.updateCode(code1778072787npBl7);
const currentCode1778072787npBl7 = flask1778072787npBl7.getCode();
var coderow1778072787npBl7 = parseInt('');
if (coderow1778072787npBl7 === undefined || coderow1778072787npBl7 !== coderow1778072787npBl7 || coderow1778072787npBl7 === 0) {
coderow1778072787npBl7 = flask1778072787npBl7.lineNumber;
}
if (coderow1778072787npBl7 < 20) {
editorElem1778072787npBl7.parentElement.style.height = '300px';
editorElem1778072787npBl7.style.height = '300px';
} else if (coderow1778072787npBl7 >= 20) {
editorElem1778072787npBl7.parentElement.style.height = '500px';
editorElem1778072787npBl7.style.height = '500px';
}
//console.log({currentCode1778072787npBl7})
const copyBtn1778072787npBl7 = document.getElementById('codeflask-copy-mPa1gN99yt');
copyBtn1778072787npBl7.addEventListener('click', function() {
try {
// 先检查 Clipboard API 是否可用
if (navigator.clipboard && navigator.clipboard.writeText) {
// 使用 Clipboard API 复制代码
navigator.clipboard.writeText(code1778072787npBl7).then(function() {
// 复制成功提示
const originalText = copyBtn1778072787npBl7.innerHTML;
copyBtn1778072787npBl7.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
// 一段时间后恢复原文本
setTimeout(function() {
copyBtn1778072787npBl7.innerHTML = originalText;
}, 2000);
}).catch(function(err) {
// 复制失败处理
console.error('复制失败:', err);
// 降级方案:使用传统的复制方法
fallbackCopyTextToClipboard(code1778072787npBl7);
});
} else {
// Clipboard API 不可用时直接使用降级方案
fallbackCopyTextToClipboard(code1778072787npBl7);
}
// 提取降级方案为独立函数
function fallbackCopyTextToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
const originalText = copyBtn1778072787npBl7.innerHTML;
copyBtn1778072787npBl7.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
setTimeout(function() {
copyBtn1778072787npBl7.innerHTML = originalText;
}, 2000);
} catch (copyErr) {
console.error('传统复制方法也失败了:', copyErr);
} finally {
document.body.removeChild(textArea);
}
}
} catch (err) {
console.error('复制功能不可用:', err);
}
});
const bottomBtn1778072787npBl7 = document.getElementById('codeflask-bottomBtn-mPa1gN99yt');
const Toggle1778072787npBl7 = document.getElementById('codeflask-Toggle-mPa1gN99yt');
bottomBtn1778072787npBl7.addEventListener('click', function() {
if (isCollapsed1778072787npBl7) {
// 展开代码
isCollapsed1778072787npBl7 = false;
const codeElement1778072787npBl7 = editorElem1778072787npBl7.querySelector('.codeflask__code');
if (codeElement1778072787npBl7) {
const actualHeight1778072787npBl7 = codeElement1778072787npBl7.scrollHeight + 20;
editorElem1778072787npBl7.parentElement.style.height = actualHeight1778072787npBl7 + 'px';
editorElem1778072787npBl7.style.height = actualHeight1778072787npBl7 + 'px';
}
bottomBtn1778072787npBl7.innerHTML = '<button class="editorjs-codeFlask_BottomToggle" title="折叠代码"><span class="toggle-icon">▲</span> 折叠</button>';
Toggle1778072787npBl7.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>';
} else {
// 折叠代码
isCollapsed1778072787npBl7 = true;
if (coderow1778072787npBl7 < 20) {
editorElem1778072787npBl7.parentElement.style.height = '300px';
editorElem1778072787npBl7.style.height = '300px';
} else if (coderow1778072787npBl7 >= 20) {
editorElem1778072787npBl7.parentElement.style.height = '500px';
editorElem1778072787npBl7.style.height = '500px';
}
bottomBtn1778072787npBl7.innerHTML = '<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>';
Toggle1778072787npBl7.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>';
}
});
Toggle1778072787npBl7.addEventListener('click', function() {
bottomBtn1778072787npBl7.click();
});
</script><div class="ce-block" data-id="GgHKFYMsR9" >
<div class="ce-block__content" style="">
<h2 class="ce-header ce-header--left">Quick Reference</h2>
</div>
</div><div class="ce-block ce-block--focused" data-id="N__98bO_K-" >
<div class="ce-block__content">
<div class="editorjs-codeFlask_Wrapper">
<div class="editorjs-codeFlask_Header">
<div class="editorjs-codeFlask_LangDisplay">javascript</div>
<button class="editorjs-codeFlask_CopyButton" title="复制代码" id="codeflask-copy-N__98bO_K-">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
<button class="editorjs-codeFlask_Toggle" id="codeflask-Toggle-N__98bO_K-">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
</div>
<div class="editorjs-codeFlask_ContentContainer">
<div class="editorjs-codeFlask_Editor" id="codeflask-N__98bO_K-" >
</div>
</div>
<div class="editorjs-codeFlask_BottomButtonContainer" id="codeflask-bottomBtn-N__98bO_K-">
<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="static/js/editorjs/tools/codeflask/codeflask150.min.js?L8J"></script>
<script type="application/javascript">
const editorElem1778072787ZMPZ6 = document.getElementById('codeflask-N__98bO_K-');
var isCollapsed1778072787ZMPZ6 = true;
const flask1778072787ZMPZ6 = new CodeFlask(editorElem1778072787ZMPZ6, {
language: 'javascript',
lineNumbers: true,
styleParent: this.shadowRoot,
rtl: false,
readonly: true
});
var code1778072787ZMPZ6 = `# Test with full details
singleshot chat -p "prompt" -P openai -d -r report.md
# Extract metrics
grep -E "(Input|Output|Total)" report.md
# Compare reports
diff report1.md report2.md
# Vision test
singleshot chat -p "Describe" -i image.jpg -P openai -d -r report.md
# List models
singleshot models -P openai
# Test connection
singleshot ping -P openai`;
code1778072787ZMPZ6 = code1778072787ZMPZ6.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
flask1778072787ZMPZ6.addLanguage('javascript', Prism.languages['javascript']);
flask1778072787ZMPZ6.onUpdate((code) => {
// do something with code here.
// this will trigger whenever the code
// in the editor changes.
// console.log(code)
});
// flask.updateCode('');
// This will also trigger .onUpdate()
flask1778072787ZMPZ6.updateCode(code1778072787ZMPZ6);
const currentCode1778072787ZMPZ6 = flask1778072787ZMPZ6.getCode();
var coderow1778072787ZMPZ6 = parseInt('');
if (coderow1778072787ZMPZ6 === undefined || coderow1778072787ZMPZ6 !== coderow1778072787ZMPZ6 || coderow1778072787ZMPZ6 === 0) {
coderow1778072787ZMPZ6 = flask1778072787ZMPZ6.lineNumber;
}
if (coderow1778072787ZMPZ6 < 20) {
editorElem1778072787ZMPZ6.parentElement.style.height = '300px';
editorElem1778072787ZMPZ6.style.height = '300px';
} else if (coderow1778072787ZMPZ6 >= 20) {
editorElem1778072787ZMPZ6.parentElement.style.height = '500px';
editorElem1778072787ZMPZ6.style.height = '500px';
}
//console.log({currentCode1778072787ZMPZ6})
const copyBtn1778072787ZMPZ6 = document.getElementById('codeflask-copy-N__98bO_K-');
copyBtn1778072787ZMPZ6.addEventListener('click', function() {
try {
// 先检查 Clipboard API 是否可用
if (navigator.clipboard && navigator.clipboard.writeText) {
// 使用 Clipboard API 复制代码
navigator.clipboard.writeText(code1778072787ZMPZ6).then(function() {
// 复制成功提示
const originalText = copyBtn1778072787ZMPZ6.innerHTML;
copyBtn1778072787ZMPZ6.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
// 一段时间后恢复原文本
setTimeout(function() {
copyBtn1778072787ZMPZ6.innerHTML = originalText;
}, 2000);
}).catch(function(err) {
// 复制失败处理
console.error('复制失败:', err);
// 降级方案:使用传统的复制方法
fallbackCopyTextToClipboard(code1778072787ZMPZ6);
});
} else {
// Clipboard API 不可用时直接使用降级方案
fallbackCopyTextToClipboard(code1778072787ZMPZ6);
}
// 提取降级方案为独立函数
function fallbackCopyTextToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
const originalText = copyBtn1778072787ZMPZ6.innerHTML;
copyBtn1778072787ZMPZ6.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
setTimeout(function() {
copyBtn1778072787ZMPZ6.innerHTML = originalText;
}, 2000);
} catch (copyErr) {
console.error('传统复制方法也失败了:', copyErr);
} finally {
document.body.removeChild(textArea);
}
}
} catch (err) {
console.error('复制功能不可用:', err);
}
});
const bottomBtn1778072787ZMPZ6 = document.getElementById('codeflask-bottomBtn-N__98bO_K-');
const Toggle1778072787ZMPZ6 = document.getElementById('codeflask-Toggle-N__98bO_K-');
bottomBtn1778072787ZMPZ6.addEventListener('click', function() {
if (isCollapsed1778072787ZMPZ6) {
// 展开代码
isCollapsed1778072787ZMPZ6 = false;
const codeElement1778072787ZMPZ6 = editorElem1778072787ZMPZ6.querySelector('.codeflask__code');
if (codeElement1778072787ZMPZ6) {
const actualHeight1778072787ZMPZ6 = codeElement1778072787ZMPZ6.scrollHeight + 20;
editorElem1778072787ZMPZ6.parentElement.style.height = actualHeight1778072787ZMPZ6 + 'px';
editorElem1778072787ZMPZ6.style.height = actualHeight1778072787ZMPZ6 + 'px';
}
bottomBtn1778072787ZMPZ6.innerHTML = '<button class="editorjs-codeFlask_BottomToggle" title="折叠代码"><span class="toggle-icon">▲</span> 折叠</button>';
Toggle1778072787ZMPZ6.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>';
} else {
// 折叠代码
isCollapsed1778072787ZMPZ6 = true;
if (coderow1778072787ZMPZ6 < 20) {
editorElem1778072787ZMPZ6.parentElement.style.height = '300px';
editorElem1778072787ZMPZ6.style.height = '300px';
} else if (coderow1778072787ZMPZ6 >= 20) {
editorElem1778072787ZMPZ6.parentElement.style.height = '500px';
editorElem1778072787ZMPZ6.style.height = '500px';
}
bottomBtn1778072787ZMPZ6.innerHTML = '<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>';
Toggle1778072787ZMPZ6.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>';
}
});
Toggle1778072787ZMPZ6.addEventListener('click', function() {
bottomBtn1778072787ZMPZ6.click();
});
</script><div class="ce-block" data-id="G1cZH6D8Ma" >
<div class="ce-block__content" style="">
<h2 class="ce-header ce-header--left">Environment Variables</h2>
</div>
</div><div class="ce-block ce-block--focused" data-id="pDegTZoRc7" >
<div class="ce-block__content">
<div class="editorjs-codeFlask_Wrapper">
<div class="editorjs-codeFlask_Header">
<div class="editorjs-codeFlask_LangDisplay">javascript</div>
<button class="editorjs-codeFlask_CopyButton" title="复制代码" id="codeflask-copy-pDegTZoRc7">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
<button class="editorjs-codeFlask_Toggle" id="codeflask-Toggle-pDegTZoRc7">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
</div>
<div class="editorjs-codeFlask_ContentContainer">
<div class="editorjs-codeFlask_Editor" id="codeflask-pDegTZoRc7" >
</div>
</div>
<div class="editorjs-codeFlask_BottomButtonContainer" id="codeflask-bottomBtn-pDegTZoRc7">
<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="static/js/editorjs/tools/codeflask/codeflask150.min.js?L8J"></script>
<script type="application/javascript">
const editorElem1778072787VMV8O = document.getElementById('codeflask-pDegTZoRc7');
var isCollapsed1778072787VMV8O = true;
const flask1778072787VMV8O = new CodeFlask(editorElem1778072787VMV8O, {
language: 'javascript',
lineNumbers: true,
styleParent: this.shadowRoot,
rtl: false,
readonly: true
});
var code1778072787VMV8O = `export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
export OPENROUTER_API_KEY="sk-or-..."`;
code1778072787VMV8O = code1778072787VMV8O.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
flask1778072787VMV8O.addLanguage('javascript', Prism.languages['javascript']);
flask1778072787VMV8O.onUpdate((code) => {
// do something with code here.
// this will trigger whenever the code
// in the editor changes.
// console.log(code)
});
// flask.updateCode('');
// This will also trigger .onUpdate()
flask1778072787VMV8O.updateCode(code1778072787VMV8O);
const currentCode1778072787VMV8O = flask1778072787VMV8O.getCode();
var coderow1778072787VMV8O = parseInt('');
if (coderow1778072787VMV8O === undefined || coderow1778072787VMV8O !== coderow1778072787VMV8O || coderow1778072787VMV8O === 0) {
coderow1778072787VMV8O = flask1778072787VMV8O.lineNumber;
}
if (coderow1778072787VMV8O < 20) {
editorElem1778072787VMV8O.parentElement.style.height = '300px';
editorElem1778072787VMV8O.style.height = '300px';
} else if (coderow1778072787VMV8O >= 20) {
editorElem1778072787VMV8O.parentElement.style.height = '500px';
editorElem1778072787VMV8O.style.height = '500px';
}
//console.log({currentCode1778072787VMV8O})
const copyBtn1778072787VMV8O = document.getElementById('codeflask-copy-pDegTZoRc7');
copyBtn1778072787VMV8O.addEventListener('click', function() {
try {
// 先检查 Clipboard API 是否可用
if (navigator.clipboard && navigator.clipboard.writeText) {
// 使用 Clipboard API 复制代码
navigator.clipboard.writeText(code1778072787VMV8O).then(function() {
// 复制成功提示
const originalText = copyBtn1778072787VMV8O.innerHTML;
copyBtn1778072787VMV8O.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
// 一段时间后恢复原文本
setTimeout(function() {
copyBtn1778072787VMV8O.innerHTML = originalText;
}, 2000);
}).catch(function(err) {
// 复制失败处理
console.error('复制失败:', err);
// 降级方案:使用传统的复制方法
fallbackCopyTextToClipboard(code1778072787VMV8O);
});
} else {
// Clipboard API 不可用时直接使用降级方案
fallbackCopyTextToClipboard(code1778072787VMV8O);
}
// 提取降级方案为独立函数
function fallbackCopyTextToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
const originalText = copyBtn1778072787VMV8O.innerHTML;
copyBtn1778072787VMV8O.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg> 已复制';
setTimeout(function() {
copyBtn1778072787VMV8O.innerHTML = originalText;
}, 2000);
} catch (copyErr) {
console.error('传统复制方法也失败了:', copyErr);
} finally {
document.body.removeChild(textArea);
}
}
} catch (err) {
console.error('复制功能不可用:', err);
}
});
const bottomBtn1778072787VMV8O = document.getElementById('codeflask-bottomBtn-pDegTZoRc7');
const Toggle1778072787VMV8O = document.getElementById('codeflask-Toggle-pDegTZoRc7');
bottomBtn1778072787VMV8O.addEventListener('click', function() {
if (isCollapsed1778072787VMV8O) {
// 展开代码
isCollapsed1778072787VMV8O = false;
const codeElement1778072787VMV8O = editorElem1778072787VMV8O.querySelector('.codeflask__code');
if (codeElement1778072787VMV8O) {
const actualHeight1778072787VMV8O = codeElement1778072787VMV8O.scrollHeight + 20;
editorElem1778072787VMV8O.parentElement.style.height = actualHeight1778072787VMV8O + 'px';
editorElem1778072787VMV8O.style.height = actualHeight1778072787VMV8O + 'px';
}
bottomBtn1778072787VMV8O.innerHTML = '<button class="editorjs-codeFlask_BottomToggle" title="折叠代码"><span class="toggle-icon">▲</span> 折叠</button>';
Toggle1778072787VMV8O.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>';
} else {
// 折叠代码
isCollapsed1778072787VMV8O = true;
if (coderow1778072787VMV8O < 20) {
editorElem1778072787VMV8O.parentElement.style.height = '300px';
editorElem1778072787VMV8O.style.height = '300px';
} else if (coderow1778072787VMV8O >= 20) {
editorElem1778072787VMV8O.parentElement.style.height = '500px';
editorElem1778072787VMV8O.style.height = '500px';
}
bottomBtn1778072787VMV8O.innerHTML = '<button class="editorjs-codeFlask_BottomToggle expand-mode" title="展开代码" data-empty="false"><span class="toggle-icon">▼</span> 展开</button>';
Toggle1778072787VMV8O.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>';
}
});
Toggle1778072787VMV8O.addEventListener('click', function() {
bottomBtn1778072787VMV8O.click();
});
</script><div class="ce-block" data-id="yfB1g-4Hvy" >
<div class="ce-block__content" style="">
<h2 class="ce-header ce-header--left">Best Practices
</h2>
</div>
</div><div class="ce-block ce-block--focused" data-id="NV8iZ-aP9U" >
<div class="ce-block__content">
<ol class="cdx-list-ordered" style="list-style-type:none; margin-left: -15px;"><li class="cdx-list__item">1. Always use<span> </span><code></code><mark style="background-color: rgb(255, 191, 0);"><code>-d</code></mark> for detailed token metrics</li><li class="cdx-list__item">2. Always use<span> </span><code><mark style="background-color: rgb(255, 191, 0);">-r</mark></code><span> </span>to save reports</li><li class="cdx-list__item">3. Always<span> </span><code><mark style="background-color: rgb(255, 191, 0);">cat</mark></code><span> </span>reports<span> </span>to analyze metrics</li><li class="cdx-list__item">4. Test variations<span> </span>and compare costs</li><li class="cdx-list__item">5. Set<span> </span><code><mark style="background-color: rgb(255, 191, 0);">--max-tokens</mark></code><span> </span>to control costs</li><li class="cdx-list__item">6. Use gpt-4o-mini<span> </span>for testing (cheaper)</li></ol>
</div>
</div><div class="ce-block" data-id="tAbsmv5fHx" >
<div class="ce-block__content" style="">
<h2 class="ce-header ce-header--left">Troubleshooting
</h2>
</div>
</div><div class="ce-block ce-block--focused" data-id="6Bzpniu9SW" >
<div class="ce-block__content">
<ul class="cdx-list-unordered"><li class="cdx-list__item">No metrics: Ensure<span> </span><code></code><mark style="background-color: rgb(255, 191, 0);"><code>-d</code></mark> flag is used</li><li class="cdx-list__item">No report file: Ensure<span> </span><code></code><mark style="background-color: rgb(255, 191, 0);"><code>-r</code></mark> flag is used</li><li class="cdx-list__item">High costs: Switch to gpt-4o-mini or Ollama</li><li class="cdx-list__item">Connection issues: <mark style="background-color: rgb(255, 191, 0);">Run<span> </span><code>singleshot ping -P <provider></code></mark><code></code></li></ul>
</div>
</div><style type="text/css">
.ce-block {
margin-top: 20px;
margin-bottom: 20px;
}
.ce-block__content,.ce-toolbar__content {
/* max-width:calc(100% - 50px) */
margin-left: auto;
margin-right: auto;
}
/**
* Plugin styles
*/
.ce-header {
position: relative;
padding: 1px 0px 1px 15px;
margin: 0;
line-height: 1.25em;
outline: none;
margin-bottom: 10px;
}
.ce-header p,
.ce-header div {
padding: 0 !important;
margin: 0 !important;
}
.ce-header::before {
content: "";
background-color: #3e8fe3;
width: 6px;
height: 100%;
position: absolute;
left: 0;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
/**
* Styles for Plugin icon in Toolbar
*/
.ce-header__icon {
}
.ce-header::before {
position: absolute;
content: attr(data-placeholder);
color: #707684;
font-weight: normal;
display: none;
cursor: text;
}
.ce-header:empty::before {
display: block;
}
.ce-header:empty:focus::before {
display: none;
}
/* FontSize */
h1.ce-header {
font-size: 2.0em;
}
h2.ce-header {
font-size: 1.7em;
}
h3.ce-header {
font-size: 1.4em;
}
h4.ce-header {
font-size: 1.15em;
}
h5.ce-header {
font-size: 0.95em;
}
h6.ce-header {
font-size: 0.8em;
}
/* Alignment*/
.ce-header--right {
text-align: right;
}
.ce-header--center {
text-align: center;
}
.ce-header--left {
text-align: left;
}
.ce-header--justify {
text-align: justify;
}
</style><style type="text/css">
.ce-block {
margin-bottom: 20px;
}
.ce-block__content,.ce-toolbar__content {
/* max-width:calc(100% - 50px) */
margin-left: auto;
margin-right: auto;
}
.ce-paragraph {
line-height: 1.6em;
outline: none;
text-indent: 2em;
font-size: 16px;
}
.ce-paragraph--right {
text-align: right;
}
.ce-paragraph--center {
text-align: center;
}
.ce-paragraph--left {
text-align: left;
}
.ce-paragraph--justify {
text-align: justify;
}
.ce-paragraph-text-indent {
text-align: justify;
}
.ce-paragraph:empty::before{
content: attr(data-placeholder);
color: #707684;
font-weight: normal;
opacity: 0;
}
/** Show placeholder at the first paragraph if Editor is empty */
.codex-editor--empty .ce-block:first-child .ce-paragraph:empty::before {
opacity: 1;
}
.codex-editor--toolbox-opened .ce-block:first-child .ce-paragraph:empty::before,
.codex-editor--empty .ce-block:first-child .ce-paragraph:empty:focus::before {
opacity: 0;
}
.ce-paragraph p:first-of-type{
margin-top: 0;
}
.ce-paragraph p:last-of-type{
margin-bottom: 0;
}
.svg-icon {
width: 1em;
height: 1em;
}
.svg-icon path,
.svg-icon polygon,
.svg-icon rect {
fill: #4691f6;
}
.svg-icon circle {
stroke: #4691f6;
stroke-width: 1;
}
</style><style type="text/css">
.ce-block {
margin-bottom: 20px;
}
.ce-block__content,.ce-toolbar__content {
/* max-width:calc(100% - 50px) */
margin-left: auto;
margin-right: auto;
position: relative;
}
/* 主容器 */
.editorjs-codeFlask_Wrapper {
border: 1px solid #dcdfe6;
border-radius: 5px;
background-color: #f6f8fa;
margin-bottom: 10px;
position: relative;
transition: all 0.3s ease;
width: 100%;
min-height: 100px;
overflow: hidden;
}
/* 标题栏 */
.editorjs-codeFlask_Header {
display: flex;
justify-content: flex-end;
align-items: center;
padding: 8px 12px;
background-color: #e9ecef;
border-bottom: 1px solid #dcdfe6;
position: relative;
z-index: 0; /* 从10降低到2 */
}
/* 语言显示 */
.editorjs-codeFlask_LangDisplay {
padding: 2px 8px;
background-color: #409eff;
color: white;
border-radius: 3px;
font-size: 12px;
font-weight: 500;
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
}
/* 内容容器 - 禁止纵向滚动 */
.editorjs-codeFlask_ContentContainer {
position: relative;
min-height: 100px;
overflow-x: hidden; /* 禁止横向滚动 */
overflow-y: hidden;
transition: height 0.3s ease;
}
/* 编辑器容器 - 禁止纵向滚动 */
.editorjs-codeFlask_Editor {
position: relative;
min-height: 100px;
overflow-x: hidden; /* 禁止横向滚动 */
overflow-y: hidden;
transition: height 0.3s ease;
}
/* 底部按钮容器 - 优化为更简洁的样式 */
.editorjs-codeFlask_BottomButtonContainer {
display: flex;
justify-content: center;
align-items: center;
padding: 4px;
background-color: #f8f9fa;
border-top: 1px solid #e9ecef;
position: relative;
z-index: 0;
}
/* 底部横向折叠/展开按钮 - 优化样式,使其更融入设计 */
.editorjs-codeFlask_BottomToggle {
width: 100%;
background-color: transparent;
color: #606266;
border: none;
border-radius: 4px;
padding: 6px 12px;
font-size: 12px;
font-weight: 400;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
text-align: center;
position: relative;
}
.editorjs-codeFlask_BottomToggle:hover {
background-color: #e9ecef;
color: #409eff;
}
.editorjs-codeFlask_BottomToggle:active {
background-color: #dee2e6;
}
.editorjs-codeFlask_BottomToggle .toggle-icon {
font-size: 11px;
transition: transform 0.3s ease;
}
/* 展开按钮(显示"展开"文本)上边缘添加渐变虚化效果 */
.editorjs-codeFlask_BottomToggle:has(span.toggle-icon:contains("▲"))::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 6px;
background: linear-gradient(to bottom, rgba(248, 249, 250, 0) 0%, rgba(248, 249, 250, 1) 100%);
pointer-events: none;
}
/* 展开按钮(显示"展开"文本)上边缘添加渐变虚化效果 */
/* 删除不被广泛支持的:contains()选择器 */
.editorjs-codeFlask_BottomToggle.expand-mode::before {
content: '';
position: absolute;
top: -60px;
left: 0;
right: 0;
height: 60px;
background: linear-gradient(to bottom, rgb(255 255 255 / 0%) 0%, rgba(248, 249, 250, 1) 100%);
pointer-events: none;
}
/* CodeFlask 主容器样式 */
.editorjs-codeFlask_Editor .codeflask {
position: relative;
background: #fafafa;
border-radius: 0 0 4px 4px;
min-height: 100px;
overflow-x: hidden; /* 禁止横向滚动 */
overflow-y: hidden;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}
/* 行号容器 */
.editorjs-codeFlask_Editor .codeflask.codeflask--has-line-numbers:before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 40px;
background-color: #f5f5f5;
border-right: 1px solid #e0e0e0;
z-index: 0;
}
/* 行号 */
.editorjs-codeFlask_Editor .codeflask__lines {
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 40px;
padding: 10px 0;
background-color: #f5f5f5;
border-right: 1px solid #e0e0e0;
z-index: 0;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 14px;
line-height: 21px;
color: #666;
text-align: right;
user-select: none;
overflow: hidden;
}
.editorjs-codeFlask_Editor .codeflask__lines__line {
padding-right: 8px;
}
/* 文本区域 - 输入框 */
.editorjs-codeFlask_Editor .codeflask__textarea {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 10px;
border: none;
background: transparent;
color: transparent;
caret-color: #333;
resize: none;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 14px;
line-height: 21px;
z-index: 1;
overflow-x: hidden; /* 禁止横向滚动 */
overflow-y: hidden;
white-space: pre-wrap; /* 自动换行 */
tab-size: 4;
outline: none;
}
/* 添加选中文本样式 */
.editorjs-codeFlask_Editor .codeflask__textarea::selection {
background-color: #b3d4fc;
color: #333;
}
.editorjs-codeFlask_Editor .codeflask__textarea::-moz-selection {
background-color: #b3d4fc;
color: #333;
}
/* 代码预览区域 */
.editorjs-codeFlask_Editor .codeflask__pre {
position: absolute;
top: 0;
left: 0;
width: 100%; /* 确保宽度不超出容器 */
height: 100%;
padding: 10px;
margin: 0;
border: none;
background: transparent;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 14px;
line-height: 21px;
z-index: 0;
overflow-x: hidden; /* 禁止横向滚动 */
overflow-y: hidden;
white-space: pre-wrap; /* 自动换行 */
pointer-events: none;
}
/* 代码高亮区域 */
.editorjs-codeFlask_Editor .codeflask__code {
display: block;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 14px;
line-height: 21px;
color: #333;
white-space: pre-wrap; /* 自动换行 */
tab-size: 4;
overflow: visible;
}
/* 语法高亮样式 - 确保Prism.js样式正确应用 */
.editorjs-codeFlask_Editor .codeflask__code {
background: transparent !important;
}
/* 通用语法高亮token样式 */
.editorjs-codeFlask_Editor .token.comment,
.editorjs-codeFlask_Editor .token.prolog,
.editorjs-codeFlask_Editor .token.doctype,
.editorjs-codeFlask_Editor .token.cdata {
color: #708090;
}
.editorjs-codeFlask_Editor .token.punctuation {
color: #999;
}
.editorjs-codeFlask_Editor .token.namespace {
opacity: 0.7;
}
.editorjs-codeFlask_Editor .token.property,
.editorjs-codeFlask_Editor .token.tag,
.editorjs-codeFlask_Editor .token.boolean,
.editorjs-codeFlask_Editor .token.number,
.editorjs-codeFlask_Editor .token.constant,
.editorjs-codeFlask_Editor .token.symbol,
.editorjs-codeFlask_Editor .token.deleted {
color: #905;
}
.editorjs-codeFlask_Editor .token.selector,
.editorjs-codeFlask_Editor .token.attr-name,
.editorjs-codeFlask_Editor .token.string,
.editorjs-codeFlask_Editor .token.char,
.editorjs-codeFlask_Editor .token.builtin,
.editorjs-codeFlask_Editor .token.inserted {
color: #690;
}
.editorjs-codeFlask_Editor .token.operator,
.editorjs-codeFlask_Editor .token.entity,
.editorjs-codeFlask_Editor .token.url,
.editorjs-codeFlask_Editor .language-css .token.string,
.editorjs-codeFlask_Editor .style .token.string {
color: #9a6e3a;
background: hsla(0, 0%, 100%, 0.5);
}
.editorjs-codeFlask_Editor .token.atrule,
.editorjs-codeFlask_Editor .token.attr-value,
.editorjs-codeFlask_Editor .token.keyword {
color: #07a;
}
.editorjs-codeFlask_Editor .token.function,
.editorjs-codeFlask_Editor .token.class-name {
color: #dd4a68;
}
.editorjs-codeFlask_Editor .token.regex,
.editorjs-codeFlask_Editor .token.important,
.editorjs-codeFlask_Editor .token.variable {
color: #e90;
}
/* 复制按钮样式 */
.editorjs-codeFlask_CopyButton {
background-color: #409eff;
color: white;
border: none;
border-radius: 3px;
padding: 6px 12px;
margin-right: 8px;
font-size: 12px;
cursor: pointer;
transition: background-color 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
min-width: 28px;
height: 28px;
}
.editorjs-codeFlask_CopyButton:hover {
background-color: #66b1ff;
}
.editorjs-codeFlask_CopyButton.copied {
background-color: #67c23a;
}
/* 折叠/展开按钮样式 */
.editorjs-codeFlask_Toggle {
background-color: #909399;
color: white;
border: none;
border-radius: 3px;
padding: 0 8px;
font-size: 12px;
cursor: pointer;
transition: background-color 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
min-width: 28px;
height: 28px;
font-weight: bold;
}
.editorjs-codeFlask_Toggle:hover {
background-color: #a6a9ad;
}
/* 响应式调整 */
@media (max-width: 768px) {
.editorjs-codeFlask_Header {
padding: 6px 8px;
}
.editorjs-codeFlask_Editor .codeflask__textarea,
.editorjs-codeFlask_Editor .codeflask__pre,
.editorjs-codeFlask_Editor .codeflask__code {
font-size: 13px;
line-height: 19px;
padding: 8px;
}
.editorjs-codeFlask_Editor .codeflask.codeflask--has-line-numbers:before {
width: 35px;
}
.editorjs-codeFlask_Editor .codeflask__lines {
width: 35px;
font-size: 12px;
}
}
/* 滚动条样式 - 完全隐藏纵向滚动条 */
.editorjs-codeFlask_Wrapper ::-webkit-scrollbar {
width: 0;/* 纵向滚动条宽度为0 */
height: 6px;/* 横向滚动条保持6px宽度 */
}
.editorjs-codeFlask_Wrapper ::-webkit-scrollbar-track {
background: transparent;
border-radius: 0;
}
.editorjs-codeFlask_Wrapper ::-webkit-scrollbar-thumb {
background: transparent;
border-radius: 0;
}
/* Firefox 滚动条隐藏 */
.editorjs-codeFlask_Wrapper {
scrollbar-width: none;/* Firefox 隐藏纵向滚动条 */
}
.editorjs-codeFlask_Wrapper ::-moz-scrollbar {
width: 0;
height: 6px;
}
/* 焦点状态 */
.editorjs-codeFlask_Wrapper:focus-within {
border-color: #409eff;
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
}
/* 只读模式样式 */
.editorjs-codeFlask_Wrapper.readonly .editorjs-codeFlask_Header {
background-color: #f5f7fa;
}
.editorjs-codeFlask_Wrapper.readonly .editorjs-codeFlask_Editor .codeflask__textarea {
cursor: default;
}
/* 确保所有元素正确显示 */
.editorjs-codeFlask_Wrapper * {
box-sizing: border-box;
}
/* 修复行号对齐 */
.editorjs-codeFlask_Editor .codeflask--has-line-numbers .codeflask__textarea,
.editorjs-codeFlask_Editor .codeflask--has-line-numbers .codeflask__pre {
padding-left: 50px;
}
.editorjs-codeFlask_Editor .codeflask--has-line-numbers .codeflask__lines {
padding-top: 10px;
}
/* 语言显示元素 - 添加点击样式 */
.editorjs-codeFlask_LangDisplay {
padding: 2px 8px;
background-color: #409eff;
color: white;
border-radius: 3px;
font-size: 12px;
font-weight: 500;
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
cursor: pointer;
transition: all 0.2s ease;
}
.editorjs-codeFlask_LangDisplay:hover {
background-color: #66b1ff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
/* 语言选择弹窗 */
.editorjs-codeFlask_LanguagePopup {
background-color: white;
border: 1px solid #dcdfe6;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
width: 250px;
max-height: 300px;
z-index: 1000;
overflow: hidden;
}
/* 搜索框 */
.editorjs-codeFlask_LanguageSearch {
width: 100%;
padding: 8px 12px;
border: none;
border-bottom: 1px solid #ebeef5;
font-size: 12px;
outline: none;
box-sizing: border-box;
}
/* 语言列表 */
.editorjs-codeFlask_LanguagesList {
max-height: 250px;
overflow-y: auto;
}
/* 语言选项 */
.editorjs-codeFlask_LanguageItem {
padding: 8px 12px;
font-size: 12px;
cursor: pointer;
transition: background-color 0.2s ease;
}
.editorjs-codeFlask_LanguageItem:hover {
background-color: #f5f7fa;
}
.editorjs-codeFlask_LanguageItem.selected {
background-color: #ecf5ff;
color: #409eff;
font-weight: 500;
}
/* 滚动条样式 */
.editorjs-codeFlask_LanguagesList::-webkit-scrollbar {
width: 6px;
}
.editorjs-codeFlask_LanguagesList::-webkit-scrollbar-track {
background-color: #f5f7fa;
}
.editorjs-codeFlask_LanguagesList::-webkit-scrollbar-thumb {
background-color: #c0c4cc;
border-radius: 3px;
}
.editorjs-codeFlask_LanguagesList::-webkit-scrollbar-thumb:hover {
background-color: #909399;
}
</style><style type="text/css">
.ce-block {
margin-bottom: 20px;
}
.ce-block__content,.ce-toolbar__content {
/* max-width:calc(100% - 50px) */
margin-left: auto;
margin-right: auto;
}
.cdx-list {
margin:0;
outline:none;
display:block;
counter-reset:item;
padding:6px;
}
.cdx-list__item {
line-height:1.45em;
display:block;
padding-top:8px;
margin-left: 2em;
}
.cdx-list__item-children {
display:block;
}
.cdx-list__item {
outline:none
}
.cdx-list__item-content {
word-break:break-word;
white-space:pre-wrap;
grid-area:content;
padding-left:8px
}
.cdx-list__item:before {
counter-increment:item;
white-space:nowrap
}
.cdx-list-li-container {
display: flex;
}
.cdx-list-ordered .cdx-list__item:before {
/* content:counters(item,".",numeric) "." */
}
.cdx-list-ordered {
list-style-type: none;
margin-left: -15px;
counter-reset:item;
font-size: 16px;
}
.cdx-list-unordered {
font-size: 16px;
}
.cdx-list-unordered .cdx-list__item:before {
content:"•"
}
.cdx-list-checklist .cdx-list__item:before {
content:""
}
.cdx-list__settings .cdx-settings-button {
width:50%
}
.cdx-list__checkbox {
padding-top:calc((1.45em - 1.2em) / 2);
grid-area:checkbox;
width:1.2em;
height:1.2em;
display:flex;
cursor:pointer;
font-size: 16px;
}
.cdx-list__checkbox svg {
opacity:0;
height:1.2em;
width:1.2em;
left:-1px;
top:-1px;
position:absolute
}
@media (hover:hover) {
.cdx-list__checkbox:not(.cdx-list__checkbox--no-hover):hover .cdx-list__checkbox-check svg {
opacity:1
}
}.cdx-list__checkbox--checked-1 {
line-height:1.45em
}
@media (hover:hover) {
.cdx-list__checkbox--checked-1:not(.cdx-list__checkbox--checked-1--no-hover):hover .cdx-checklist__checkbox-check {
background:#0059AB;
border-color:#0059AB
}
}.cdx-list__checkbox--checked-1 .cdx-list__checkbox-check {
background:#369FFF;
border-color:#369FFF
}
.cdx-list__checkbox--checked-1 .cdx-list__checkbox-check svg {
opacity:1
}
.cdx-list__checkbox--checked-1 .cdx-list__checkbox-check svg path {
stroke:#fff
}
.cdx-list__checkbox--checked-1 .cdx-list__checkbox-check:before {
opacity:0;
visibility:visible;
transform:scale(2.5)
}
.cdx-list__checkbox-check {
cursor:pointer;
display:inline-block;
position:relative;
margin:0 auto;
width:1.2em;
height:1.2em;
box-sizing:border-box;
border-radius:5px;
border:1px solid #C9C9C9;
background:#fff
}
.cdx-list__checkbox-check:before {
content:"";
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
border-radius:100%;
background-color:#369FFF;
visibility:hidden;
pointer-events:none;
transform:scale(1);
transition:transform .4s ease-out,opacity .4s
}
.cdx-list__checkbox-check--disabled {
pointer-events:none
}
.cdx-list-start-with-field {
background:#F8F8F8;
border:1px solid rgba(226,226,229,.2);
border-radius:6px;
padding:2px;
display:grid;
grid-template-columns:auto auto 1fr;
grid-template-rows:auto
}
.cdx-list-start-with-field--invalid {
background:#FFECED;
border:1px solid #E13F3F
}
.cdx-list-start-with-field--invalid .cdx-list-start-with-field__input {
color:#e13f3f
}
.cdx-list-start-with-field__input {
font-size:16px;
outline:none;
font-weight:500;
font-family:inherit;
border:0;
background:transparent;
margin:0;
padding:0;
line-height:22px;
min-width:calc(100% - 10px)
}
.cdx-list-start-with-field__input::placeholder {
color:#797979;
font-weight:500
}
</style><style type="text/css">
.inline-code {
background: rgba(250, 239, 240, 0.78);
color: #b44437;
padding: 3px 4px;
border-radius: 5px;
margin: 0 1px;
font-family: inherit;
font-size: 0.86em;
font-weight: 500;
letter-spacing: 0.3px;
}
</style>
页:
[1]