mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-17 11:07:11 +08:00
feat: sync knowledge management to desktop
This commit is contained in:
@@ -1100,7 +1100,7 @@
|
||||
|
||||
<!-- Knowledge Action Dialog -->
|
||||
<div id="knowledge-dialog-overlay" class="fixed inset-0 bg-black/50 z-[200] hidden flex items-center justify-center">
|
||||
<div id="knowledge-dialog-card" class="bg-white dark:bg-[#1A1A1A] rounded-2xl border border-slate-200 dark:border-white/10 shadow-xl w-full max-w-md mx-4 overflow-hidden">
|
||||
<div id="knowledge-dialog-card" class="bg-white dark:bg-[#1A1A1A] rounded-2xl border border-slate-200 dark:border-white/10 shadow-xl w-full max-w-md mx-4">
|
||||
<div class="p-6">
|
||||
<div class="flex items-center gap-3 mb-5">
|
||||
<div class="w-10 h-10 rounded-xl bg-emerald-50 dark:bg-emerald-900/20 flex items-center justify-center">
|
||||
@@ -1114,8 +1114,13 @@
|
||||
<label id="knowledge-dialog-label" class="block text-sm font-medium text-slate-600 dark:text-slate-300 mb-1.5"></label>
|
||||
<input id="knowledge-dialog-input" type="text"
|
||||
class="w-full px-3 py-2 rounded-lg border border-slate-200 dark:border-slate-600 bg-slate-50 dark:bg-white/5 text-sm text-slate-800 dark:text-slate-100 focus:outline-none focus:border-primary-500">
|
||||
<select id="knowledge-dialog-select"
|
||||
class="hidden w-full pl-3 pr-8 py-2 rounded-lg border border-slate-200 dark:border-slate-600 bg-slate-50 dark:bg-[#222] text-sm text-slate-800 dark:text-slate-100 focus:outline-none focus:border-primary-500"></select>
|
||||
<div id="knowledge-dialog-select" class="cfg-dropdown hidden w-full" tabindex="0">
|
||||
<div class="cfg-dropdown-selected">
|
||||
<span class="cfg-dropdown-text">--</span>
|
||||
<i class="fas fa-chevron-down cfg-dropdown-arrow"></i>
|
||||
</div>
|
||||
<div class="cfg-dropdown-menu"></div>
|
||||
</div>
|
||||
<textarea id="knowledge-dialog-textarea" rows="8"
|
||||
class="hidden w-full px-3 py-2 rounded-lg border border-slate-200 dark:border-slate-600 bg-slate-50 dark:bg-white/5 text-sm text-slate-800 dark:text-slate-100 focus:outline-none focus:border-primary-500 font-mono resize-y"></textarea>
|
||||
<div id="knowledge-document-form" class="hidden space-y-3">
|
||||
|
||||
@@ -8054,7 +8054,10 @@ function openKnowledgeDialog(options) {
|
||||
documentContent.focus();
|
||||
};
|
||||
if (options.type === 'select') {
|
||||
select.innerHTML = (options.choices || []).map(value => `<option value="${escapeHtml(value)}">${escapeHtml(value)}</option>`).join('');
|
||||
// Use the shared custom dropdown component instead of a native
|
||||
// <select> so the arrow / menu match the rest of the console.
|
||||
const ddOptions = (options.choices || []).map(value => ({ value, label: value }));
|
||||
initDropdown(select, ddOptions, (options.choices || [])[0] || '', null);
|
||||
}
|
||||
submit.textContent = currentLang === 'zh' ? '确定' : 'Confirm';
|
||||
cancel.textContent = currentLang === 'zh' ? '取消' : 'Cancel';
|
||||
@@ -8062,7 +8065,7 @@ function openKnowledgeDialog(options) {
|
||||
|
||||
const close = () => overlay.classList.add('hidden');
|
||||
const submitAction = async () => {
|
||||
const rawValue = options.type === 'select' ? select.value :
|
||||
const rawValue = options.type === 'select' ? getDropdownValue(select) :
|
||||
(options.type === 'textarea' ? textarea.value :
|
||||
(options.type === 'document' ? {
|
||||
filename: documentFilename.value.trim(),
|
||||
|
||||
Reference in New Issue
Block a user