交互:回形针按钮改为直接上传文件,新增文件夹按钮打开任务文件面板
This commit is contained in:
@@ -132,7 +132,10 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="ia-side ia-right">
|
||||
<button class="plus-btn" id="attach-btn" title="任务文件" aria-label="任务文件">
|
||||
<button class="plus-btn" id="files-btn" title="任务文件" aria-label="任务文件">
|
||||
<svg viewBox="0 0 24 24" class="ic sm"><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path></svg>
|
||||
</button>
|
||||
<button class="plus-btn" id="attach-btn" title="上传文件" aria-label="上传文件">
|
||||
<svg viewBox="0 0 24 24" class="ic sm"><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"></path></svg>
|
||||
</button>
|
||||
<button class="send-btn" id="send-btn" title="发送" aria-label="发送">
|
||||
@@ -168,7 +171,7 @@
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<!-- ================= 任务文件面板(浮层:点输入行右侧发送旁的附件按钮展开;盖住输入区+遮罩) ================= -->
|
||||
<!-- ================= 任务文件面板(浮层:点输入行右侧文件夹按钮展开;盖住输入区+遮罩) ================= -->
|
||||
<div id="files-mask" aria-hidden="true"></div>
|
||||
<div class="files-panel" id="files-panel" aria-label="任务文件">
|
||||
<div class="files-panel-header">
|
||||
@@ -1850,7 +1853,7 @@
|
||||
toast(state.deepThink ? '深度思考已开启' : '深度思考已关闭');
|
||||
});
|
||||
|
||||
// ---------- 任务文件面板(底部浮层:点输入行右侧发送旁的附件按钮展开,遮罩盖住输入区) ----------
|
||||
// ---------- 任务文件面板(底部浮层:点输入行右侧文件夹按钮展开,遮罩盖住输入区) ----------
|
||||
function setFilesPanel(open) {
|
||||
const panel = $('files-panel');
|
||||
if (open) {
|
||||
@@ -1860,7 +1863,7 @@
|
||||
}
|
||||
panel.classList.toggle('open', open);
|
||||
$('files-mask').classList.toggle('show', open);
|
||||
$('attach-btn').classList.toggle('active', open);
|
||||
$('files-btn').classList.toggle('active', open);
|
||||
}
|
||||
let ensuringSessionForFiles = false; // 防止建会话请求发出前重复点击按钮导致连建两个会话
|
||||
async function toggleFilesPanel() {
|
||||
@@ -1881,7 +1884,25 @@
|
||||
}
|
||||
setFilesPanel(open);
|
||||
}
|
||||
$('attach-btn').addEventListener('click', toggleFilesPanel);
|
||||
$('files-btn').addEventListener('click', toggleFilesPanel);
|
||||
// 附件(回形针)按钮:直接唤起文件选择写入当前会话任务目录;无会话时先建会话再弹选择器,
|
||||
// 避免选完文件后因无会话被丢弃(与面板同策略)。
|
||||
let ensuringSessionForUpload = false;
|
||||
$('attach-btn').addEventListener('click', async () => {
|
||||
if (!state.sessionId) {
|
||||
if (ensuringSessionForUpload) return;
|
||||
ensuringSessionForUpload = true;
|
||||
try {
|
||||
await ensureSession();
|
||||
} catch (e) {
|
||||
toast('创建会话失败:' + e.message);
|
||||
return;
|
||||
} finally {
|
||||
ensuringSessionForUpload = false;
|
||||
}
|
||||
}
|
||||
$('file-input').click();
|
||||
});
|
||||
$('files-mask').addEventListener('click', () => setFilesPanel(false)); // 点遮罩收起
|
||||
|
||||
// 任务文件面板多选状态:Set 保留当前选中的文件路径;filesAllPaths 保留当前面板所有路径。
|
||||
|
||||
Reference in New Issue
Block a user