Improve writer prompt testing
This commit is contained in:
@@ -118,6 +118,7 @@
|
||||
.prompt-hint summary { cursor:pointer; font-weight:700; }
|
||||
.prompt-hint pre, .prompt-box { white-space:pre-wrap; overflow:auto; padding:10px; border:1px solid var(--line); border-radius:8px; background:#f8fafc; color:var(--text); }
|
||||
.prompt-test-layout { display:grid; grid-template-columns:minmax(0, 1fr) 420px; gap:16px; align-items:start; }
|
||||
.prompt-test-controls { display:grid; grid-template-columns:150px minmax(260px, 1fr) minmax(220px, .7fr); gap:12px; align-items:end; }
|
||||
.prompt-test-main { margin-bottom:0; }
|
||||
.prompt-test-side { display:grid; gap:16px; position:sticky; top:74px; max-height:calc(100vh - 92px); overflow:auto; }
|
||||
.prompt-test-model { min-height:38px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
|
||||
@@ -125,6 +126,7 @@
|
||||
.prompt-test-post-head { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:4px; }
|
||||
.prompt-test-post pre { max-height:260px; overflow:auto; margin:10px 0 0; white-space:pre-wrap; font:inherit; color:var(--text); }
|
||||
.prompt-test-help p { margin:0; }
|
||||
.human-answer { white-space:pre-wrap; overflow:auto; max-height:360px; padding:12px; border:1px solid #b7caf8; border-radius:8px; background:#f8fbff; color:var(--text); font:16px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; }
|
||||
.hint-grid { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px; }
|
||||
.hint-label { color:var(--muted); font-size:12px; font-weight:700; text-transform:uppercase; margin-bottom:3px; }
|
||||
.small-help { font-size:12px; margin-top:4px; }
|
||||
@@ -216,7 +218,7 @@
|
||||
.regen-form { margin-top:16px; border-top:1px solid var(--line); padding-top:14px; }
|
||||
.compact-kv { margin-top:12px; grid-template-columns:90px minmax(0,1fr); }
|
||||
.empty-state { text-align:center; color:var(--muted); padding:34px; }
|
||||
@media (max-width: 900px) { header { padding:8px 12px; align-items:flex-start; } .filter-grid, .sources-filter, .source-add-grid, .hint-grid, .advanced-grid, .tool-row, .tool-row.sort-row, .editor-filter, .page-head, .compare-grid, .dialog-grid, .catalog-layout, .media-upload-form, .category-create, .prompt-test-layout { grid-template-columns:1fr; } .page-head { display:grid; } .form-grid { grid-template-columns:1fr; } .detail-grid { grid-template-columns:1fr; } .editor-card { grid-template-columns:1fr; } .editor-actions { grid-template-columns:repeat(3, minmax(0,1fr)); } .context-pane { border-right:0; border-bottom:1px solid var(--line); max-height:none; } .edit-pane { max-height:none; } .side-panel, .filter-sidebar, .prompt-test-side { position:static; max-height:none; } .list-toolbar { display:grid; align-items:start; } .compact-controls { justify-content:start; } main { padding:14px; } }
|
||||
@media (max-width: 900px) { header { padding:8px 12px; align-items:flex-start; } .filter-grid, .sources-filter, .source-add-grid, .hint-grid, .advanced-grid, .tool-row, .tool-row.sort-row, .editor-filter, .page-head, .compare-grid, .dialog-grid, .catalog-layout, .media-upload-form, .category-create, .prompt-test-layout, .prompt-test-controls { grid-template-columns:1fr; } .page-head { display:grid; } .form-grid { grid-template-columns:1fr; } .detail-grid { grid-template-columns:1fr; } .editor-card { grid-template-columns:1fr; } .editor-actions { grid-template-columns:repeat(3, minmax(0,1fr)); } .context-pane { border-right:0; border-bottom:1px solid var(--line); max-height:none; } .edit-pane { max-height:none; } .side-panel, .filter-sidebar, .prompt-test-side { position:static; max-height:none; } .list-toolbar { display:grid; align-items:start; } .compact-controls { justify-content:start; } main { padding:14px; } }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -33,7 +33,15 @@
|
||||
<form class="prompt-test-layout" method="post" action="/prompt-test">
|
||||
<input type="hidden" name="csrf_token" value="{{ user.csrf_token }}">
|
||||
<section class="panel prompt-test-main">
|
||||
<div class="form-grid">
|
||||
<div class="prompt-test-controls">
|
||||
<label>
|
||||
<span>Фильтр</span>
|
||||
<select name="q_status" data-status-select>
|
||||
{% for item in status_options %}
|
||||
<option value="{{ item.value }}" {% if q_status == item.value %}selected{% endif %}>{{ item.label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
<span>Пост для теста</span>
|
||||
<select name="post_id" data-post-select>
|
||||
@@ -85,6 +93,14 @@
|
||||
<dt>Токены</dt><dd>{{ result.usage.total_tokens or "—" }} total, {{ result.usage.prompt_tokens or "—" }} prompt, {{ result.usage.completion_tokens or "—" }} completion</dd>
|
||||
<dt>Стоимость</dt><dd>{{ result.usage.estimated_cost_usd or "—" }}</dd>
|
||||
</dl>
|
||||
{% if result.preview_text %}
|
||||
<h3>Как будет выглядеть</h3>
|
||||
<pre class="human-answer">{{ result.preview_text }}</pre>
|
||||
<dl class="kv compact-kv">
|
||||
<dt>Категория</dt><dd>{{ result.preview_category or "—" }}</dd>
|
||||
<dt>Заметка</dt><dd>{{ result.preview_notes or "—" }}</dd>
|
||||
</dl>
|
||||
{% endif %}
|
||||
{% if result.parsed_json %}
|
||||
<h3>JSON разобран</h3>
|
||||
<pre class="json-box">{{ result.parsed_json }}</pre>
|
||||
@@ -98,9 +114,14 @@
|
||||
</aside>
|
||||
</form>
|
||||
<script>
|
||||
const statusSelect = document.querySelector("[data-status-select]");
|
||||
document.querySelector("[data-post-select]")?.addEventListener("change", (event) => {
|
||||
const id = event.target.value;
|
||||
if (id) window.location.href = `/prompt-test?post_id=${encodeURIComponent(id)}`;
|
||||
const status = statusSelect?.value || "all";
|
||||
if (id) window.location.href = `/prompt-test?post_id=${encodeURIComponent(id)}&q_status=${encodeURIComponent(status)}`;
|
||||
});
|
||||
statusSelect?.addEventListener("change", (event) => {
|
||||
window.location.href = `/prompt-test?q_status=${encodeURIComponent(event.target.value)}`;
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user