forked from laysense/laysite
Prepare LaySite 1.4.4 editor templates and MCP settings
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
use App\Content\McpSettings;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
@@ -29,3 +30,32 @@ $e = View::escape(...);
|
||||
</fieldset>
|
||||
<button type="submit" class="button button-primary"><?= View::fragment('studio-icon', ['icon' => 'save']) ?>保存设置</button>
|
||||
</form>
|
||||
<form id="mcp-settings" class="admin-form admin-panel" method="post" action="/admin/settings" aria-labelledby="mcp-settings-title">
|
||||
<header class="admin-heading compact"><h2 id="mcp-settings-title">MCP</h2></header>
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="settings_section" value="mcp">
|
||||
<input type="hidden" name="version" value="<?= $e($mcp['version']) ?>">
|
||||
<label><input type="checkbox" name="mcp_enabled" value="1"<?= $mcp['enabled'] ? ' checked' : '' ?>> 开放 MCP</label>
|
||||
<p class="field-note">允许持有密钥的 AI 客户端通过 Streamable HTTP 新建和编辑草稿。</p>
|
||||
<?php if ($mcp['enabled']): ?>
|
||||
<label>连接网址<input type="url" readonly value="<?= $e(View::absolute(McpSettings::PATH)) ?>"></label>
|
||||
<?php if ($mcp['token'] === null): ?>
|
||||
<p class="feedback error">当前密钥无法读取。生成新密钥后即可重新连接。</p>
|
||||
<?php else: ?>
|
||||
<details class="settings-stack">
|
||||
<summary>查看连接密钥</summary>
|
||||
<label>Bearer 密钥<input type="text" readonly spellcheck="false" autocomplete="off" value="<?= $e($mcp['token']) ?>"></label>
|
||||
<p class="field-note">在客户端设置 Authorization 请求头,格式为 Bearer 后加一个空格和密钥。</p>
|
||||
</details>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
<?php if ($mcp['legacy']): ?>
|
||||
<p class="field-note">当前密钥来自环境变量 LAYSITE_MCP_TOKEN。保存后由后台管理。</p>
|
||||
<?php endif ?>
|
||||
<div class="actions">
|
||||
<button type="submit" class="button button-primary"><?= View::fragment('studio-icon', ['icon' => 'save']) ?>保存 MCP 设置</button>
|
||||
<?php if ($mcp['enabled']): ?>
|
||||
<button type="submit" class="button button-outline" name="rotate_mcp_token" value="1" data-confirm="生成新密钥后,原有的 MCP 连接需要更换密钥。继续吗?"><?= View::fragment('studio-icon', ['icon' => 'refresh']) ?>生成新密钥</button>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user