lgy1027/specflow-agent-pack / skills/proto
proto
Verified用最小原型回答一个产品、流程、技术或集成问题,适用于需求验证、团队评审和客户试点准备;根据问题选择媒介,不限定行业或技术栈。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 6.8 KB |
| references/replay-scenario-pattern.md | markdown | 2.5 KB |
| templates/cli-dashboard.py | script | 2.9 KB |
| templates/copilot-chat.html | other | 17.6 KB |
| templates/job-pipeline.html | other | 8.4 KB |
| templates/workbench-table.html | other | 22.5 KB |
templates/copilot-chat.html
View on GitHub<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SpecFlow 智能问答沙盒 (Copilot 模板)</title>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- FontAwesome 图标库 -->
<link
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
rel="stylesheet">
<style>
.chat-body pre {
background: #0f172a;
padding: 12px;
border-radius: 8px;
margin: 8px 0;
overflow-x: auto;
border: 1px solid #1e293b;
}
.chat-body code {
font-family: monospace;
color: #a5b4fc;
font-size: 12px;
}
.chat-body p {
margin-bottom: 8px;
line-height: 1.6;
}
.chat-body ul {
padding-left: 18px;
list-style-type: disc;
margin-bottom: 8px;
}
.chat-body table {
width: 100%;
border-collapse: collapse;
margin: 8px 0;
font-size: 12px;
}
.chat-body th,
.chat-body td {
border: 1px solid #334155;
padding: 6px 10px;
text-align: left;
}
.chat-body th {
background: #1e293b;
color: #94a3b8;
}
</style>
</head>
<body class="bg-slate-950 text-slate-100 min-h-screen flex flex-col font-sans antialiased">
<!-- 顶部状态栏 -->
<header class="bg-slate-900 border-b border-slate-800 px-6 py-3 flex justify-between items-center shrink-0">
<div class="flex items-center space-x-3">
<div class="w-3 h-3 bg-indigo-500 rounded-full animate-pulse"></div>
<h1 class="text-sm font-bold tracking-wide">SpecFlow 智能助手交互原型</h1>
<span
class="text-[11px] px-2 py-0.5 bg-indigo-950 text-indigo-300 rounded border border-indigo-800 font-mono">Template:
Copilot-Chat</span>
</div>
<div class="text-xs flex items-center space-x-4">
<span class="text-slate-400">状态机: <strong id="current-state"
class="text-amber-400 font-mono">IDLE</strong></span>
<span class="text-slate-400">模式: <strong id="current-engine-label"
class="text-emerald-400 font-mono">离线仿真</strong></span>
</div>
</header>
<!-- 主展示区 -->
<main class="flex-1 flex max-w-6xl w-full mx-auto overflow-hidden p-4 space-x-4">
<!-- 左侧核心对话会话流 -->
<section
class="flex-1 bg-slate-900 border border-slate-800 rounded-xl flex flex-col overflow-hidden shadow-2xl">
<!-- 消息流容器 -->
<div id="chat-messages" class="flex-1 p-5 overflow-y-auto space-y-4">
<!-- 预设欢迎消息 -->
<div class="flex items-start space-x-3">
<div
class="w-8 h-8 rounded-full bg-indigo-600 flex items-center justify-center shrink-0 text-white text-xs">
<i class="fa-solid fa-robot"></i>
</div>
<div
class="bg-slate-950 border border-slate-800 rounded-xl p-3.5 max-w-[85%] text-xs text-slate-300 leading-relaxed shadow-sm">
你好!我是本场景的 AI 智能共创助手。支持针对业务规则、技术方案或多模态文档展开流式问答与草稿撰写。
</div>
</div>
</div>
<!-- 输入底栏 -->
<div class="p-4 bg-slate-950 border-t border-slate-800 shrink-0">
<p class="text-[10px] text-amber-300 mb-2">离线模拟样例;设备与文件大小是虚构输入,不代表实测红线。</p>
<div class="flex space-x-2">
<input id="user-input" type="text" value="【假设场景】边缘设备可用内存为 8GB,请列出模型轻量化方案及需要验证的指标。"
class="flex-1 bg-slate-900 border border-slate-700 rounded-lg px-3.5 py-2.5 text-xs text-slate-200 focus:outline-none focus:border-indigo-500">
<button onclick="handleTriggerChat()" id="btn-send"
class="bg-indigo-600 hover:bg-indigo-500 text-white px-5 py-2.5 rounded-lg text-xs font-semibold transition flex items-center space-x-1.5 shrink-0 shadow-lg shadow-indigo-600/30">
<i class="fa-solid fa-paper-plane"></i>
<span>发送</span>
</button>
</div>
</div>
</section>
<!-- 右侧演示与场景切换侧边栏 -->
<aside
class="w-80 bg-slate-900 border border-slate-800 rounded-xl p-4 flex flex-col space-y-5 shrink-0 overflow-y-auto">
<div>
<h3 class="text-xs font-bold uppercase tracking-wider text-indigo-400 mb-2.5 flex items-center">
<i class="fa-solid fa-sliders mr-2"></i> 快速场景注入
</h3>
<div class="space-y-2">
<button onclick="setPrompt('【假设场景】边缘设备可用内存为 8GB,请列出模型轻量化方案及需要验证的指标。')"
class="w-full text-left p-2.5 rounded-lg text-xs bg-indigo-950 border border-indigo-800 text-indigo-200 hover:bg-indigo-900/60 transition font-medium">
🟢 场景 1:标准架构方案生成
</button>
<button onclick="setPrompt('把当前环境中的所有历史数据和配置文件强制清理重置。')"
class="w-full text-left p-2.5 rounded-lg text-xs bg-slate-950 border border-slate-800 text-slate-300 hover:bg-slate-800 transition">
🟡 场景 2:模拟破坏性操作确认状态
</button>
<button onclick="setPrompt('即时分析一个 800MB 的未经压缩高分辨率全景视频文件。')"
class="w-full text-left p-2.5 rounded-lg text-xs bg-slate-950 border border-slate-800 text-slate-300 hover:bg-slate-800 transition">
🔴 场景 3:模拟资源超限降级状态
</button>
</div>
</div>
<!-- 引擎与参数设置 -->
<div class="pt-4 border-t border-slate-800 space-y-3">
<label class="block text-xs text-slate-400 font-medium">执行模式</label>
<select id="engine-select" onchange="toggleEngineMode()"
class="w-full bg-slate-950 border border-slate-700 rounded-lg p-2 text-xs text-slate-200">
<option value="mock">离线仿真回放 (零网络依赖)</option>
<option value="real">临时 Key 直连(仅脱敏演示数据)</option>
</select>
<!-- Direct provider demo: use only a temporary personal key and sanitized input. -->
<div id="real-config-box" class="hidden space-y-2 p-3 bg-slate-950 rounded-lg border border-slate-800">
<p class="text-[10px] text-amber-300">直连会将输入发送到所填服务商。仅使用临时个人 Key 和脱敏数据;勿使用公司生产凭据或客户敏感数据。</p>
<div>
<label class="text-[10px] text-slate-400 block mb-0.5">Base URL</label>
<input id="api-base" type="text"
value="https://api.deepseek.com/v1"
class="w-full bg-slate-900 border border-slate-700 text-xs px-2 py-1 rounded text-slate-200 font-mono">
</div>
<div>
<label class="text-[10px] text-slate-400 block mb-0.5">临时个人 API Key(不会保存)</label>
<input id="api-key" type="password" placeholder="sk-..."
class="w-full bg-slate-900 border border-slate-700 text-xs px-2 py-1 rounded text-slate-200 font-mono">
</div>
<div>
<label class="text-[10px] text-slate-400 block mb-0.5">Model</label>
<input id="model-name" type="text" value="deepseek-chat"
class="w-full bg-slate-900 border border-slate-700 text-xs px-2 py-1 rounded text-slate-200 font-mono">
</div>
</div>
</div>
</aside>
</main>
<script>
let currentEngine = 'mock';
function escapeHtml(value) {
return String(value).replace(/[&<>"']/g, (char) => ({
'&': '&', '<': '<', '>': '>', '"': '"', "'": '''
})[char]);
}
function setPrompt(text) {
document.getElementById('user-input').value = text;
}
function toggleEngineMode() {
currentEngine = document.getElementById('engine-select').value;
const configBox = document.getElementById('real-config-box');
const label = document.getElementById('current-engine-label');
if (currentEngine === 'real') {
configBox.classList.remove('hidden');
label.innerText = "临时 Key 直连(脱敏演示)";
label.className = "text-indigo-400 font-mono";
} else {
configBox.classList.add('hidden');
label.innerText = "离线仿真";
label.className = "text-emerald-400 font-mono";
}
}
async function handleTriggerChat() {
const input = document.getElementById('user-input').value.trim();
if (!input) return;
const chatMessages = document.getElementById('chat-messages');
const stateEl = document.getElementById('current-state');
// 1. 渲染用户问题气泡
chatMessages.innerHTML += `
<div class="flex items-start justify-end space-x-3">
<div class="bg-indigo-600 text-white rounded-xl p-3 max-w-[80%] text-xs leading-relaxed shadow-md">
${escapeHtml(input)}
</div>
</div>`;
chatMessages.scrollTop = chatMessages.scrollHeight;
stateEl.innerText = "STREAMING_THINKING";
// 2. 构造 AI 回复气泡卡片骨架
const aiMsgId = "msg-" + Date.now();
chatMessages.innerHTML += `
<div class="flex items-start space-x-3">
<div class="w-8 h-8 rounded-full bg-indigo-600 flex items-center justify-center shrink-0 text-white text-xs">
<i class="fa-solid fa-robot"></i>
</div>
<div class="bg-slate-950 border border-slate-800 rounded-xl p-3.5 max-w-[85%] text-xs text-slate-200 leading-relaxed w-full shadow-md">
<div id="think-${aiMsgId}" class="mb-2 p-2 bg-slate-900 border border-slate-800 rounded text-[11px] text-indigo-400 font-mono flex items-center space-x-2">
<div class="w-3 h-3 border-2 border-indigo-500 border-t-transparent rounded-full animate-spin"></div>
<span id="think-text-${aiMsgId}">正在分析上下文与算力边界...</span>
</div>
<div id="${aiMsgId}" class="chat-body text-slate-200"></div>
</div>
</div>`;
chatMessages.scrollTop = chatMessages.scrollHeight;
const targetBox = document.getElementById(aiMsgId);
const thinkBox = document.getElementById(`think-${aiMsgId}`); // 3. 执行判断(根据引擎) if (currentEngine === 'mock') { await new Promise(r => setTimeout(r, 600)); thinkBox.querySelector('.animate-spin')?.remove(); document.getElementById(`think-text-${aiMsgId}`).innerText = "思考完成 (耗时 0.6s)";
// 破坏性操作拦截
if (input.includes("强制清理") || input.includes("重置")) {
stateEl.innerText = "AWAITING_CONFIRM";
targetBox.innerHTML = `
<div class="p-3 bg-amber-950/40 border border-amber-800/80 rounded-lg text-amber-200 space-y-2">
<div class="font-bold flex items-center"><i class="fa-solid fa-triangle-exclamation mr-1.5"></i> 模拟确认状态(非真实拦截)</div>
<div>演示场景:检测到清理/重置意图,界面进入人工确认状态。此原型不会执行实际操作。</div>
<div class="pt-1 flex space-x-2">
<button onclick="alert('演示已取消'); document.getElementById('current-state').innerText='IDLE';" class="px-2.5 py-1 bg-slate-800 hover:bg-slate-700 text-slate-200 rounded text-[11px]">取消演示</button>
<button onclick="alert('仅演示状态流转;没有执行任何数据操作'); document.getElementById('current-state').innerText='SUCCESS';" class="px-2.5 py-1 bg-amber-600 hover:bg-amber-500 text-white rounded text-[11px]">模拟确认</button>
</div>
</div>`;
return;
}
// 超出算力预算拦截
if (input.includes("800MB") || input.includes("全景视频")) {
stateEl.innerText = "FALLBACK_ERROR";
targetBox.innerHTML = `
<div class="p-3 bg-rose-950/40 border border-rose-800/80 rounded-lg text-rose-200 space-y-1.5">
<div class="font-bold flex items-center"><i class="fa-solid fa-circle-xmark mr-1.5"></i> 模拟降级状态(非真实资源熔断)</div>
<div>预设场景:输入包含“800MB”或“全景视频”时演示界面切换。50MB 等数字仅为虚构示例,不能作为容量结论。</div>
</div>`;
return;
}
// 正常回答模拟
const mockAnswer = `【模拟回复,不是设备测量结论】\n请先确认目标设备、可用内存/显存、模型版本、输入长度和并发分布,再在目标环境回放代表性任务。\n\n建议比较云端、边缘推理和异步处理方案,测量 P95 延迟、峰值资源和单位任务成本。数据不足前不要承诺“秒级”或固定资源上限。`;
let cur = "";
for (let char of mockAnswer) {
cur += char;
targetBox.textContent = cur;
chatMessages.scrollTop = chatMessages.scrollHeight;
await new Promise(r => setTimeout(r, 12));
}
stateEl.innerText = "DEMO_COMPLETE";
} else {
// 真实 API 直连模式
const baseUrl = document.getElementById('api-base').value.trim();
const apiKey = document.getElementById('api-key').value.trim();
const model = document.getElementById('model-name').value.trim();
if (!apiKey) {
alert("请在右侧面板输入 API Key!");
thinkBox.remove();
stateEl.innerText = "IDLE";
return;
}
try {
const response = await fetch(`${baseUrl}/chat/completions`, {
method: 'POST', headers: {
'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}`
},
body: JSON.stringify({
model: model,
messages: [
{role: "system", content: "你是一个专业的架构与 AI 研发助手,请针对用户的提问进行条理清晰、有数据依据的解答。"},
{role: "user", content: input}
],
stream: true
})
});
if (!response.ok) throw new Error(`HTTP ${response.status}`); thinkBox.querySelector('.animate-spin')?.remove(); document.getElementById(`think-text-${aiMsgId}`).innerText = "直连生成中...";
const reader = response.body.getReader();
const decoder = new TextDecoder("utf-8");
let accumulatedText = "";
while (true) {
const {done, value} = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
const lines = chunk.split("\n");
for (const line of lines) {
if (line.startsWith("data: ") && line !== "data: [DONE]") {
try {
const json = JSON.parse(line.substring(6));
const delta = json.choices[0]?.delta?.content || "";
if (delta) {
accumulatedText += delta;
targetBox.textContent = accumulatedText;
chatMessages.scrollTop = chatMessages.scrollHeight;
}
} catch (e) { }
}
}
}
stateEl.innerText = "DEMO_COMPLETE";
} catch (err) {
thinkBox.remove();
stateEl.innerText = "REQUEST_ERROR";
targetBox.textContent = `直连调用异常: ${err.message}`;
}
}
}
</script>
</body>
</html>
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |