@hirohsu/user-web-feedback 2.8.10 → 2.8.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +953 -953
  2. package/dist/cli.cjs +33283 -46043
  3. package/dist/index.cjs +35747 -48509
  4. package/dist/static/app.js +385 -385
  5. package/dist/static/components/navbar.css +406 -406
  6. package/dist/static/components/navbar.html +49 -49
  7. package/dist/static/components/navbar.js +211 -211
  8. package/dist/static/dashboard.css +495 -495
  9. package/dist/static/dashboard.html +95 -95
  10. package/dist/static/dashboard.js +540 -540
  11. package/dist/static/favicon.svg +27 -27
  12. package/dist/static/index.html +541 -541
  13. package/dist/static/logs.html +376 -376
  14. package/dist/static/logs.js +442 -442
  15. package/dist/static/mcp-settings.html +797 -797
  16. package/dist/static/mcp-settings.js +884 -884
  17. package/dist/static/modules/app-core.js +124 -124
  18. package/dist/static/modules/conversation-panel.js +247 -247
  19. package/dist/static/modules/feedback-handler.js +1420 -1420
  20. package/dist/static/modules/image-handler.js +155 -155
  21. package/dist/static/modules/log-viewer.js +296 -296
  22. package/dist/static/modules/mcp-manager.js +474 -474
  23. package/dist/static/modules/prompt-manager.js +364 -364
  24. package/dist/static/modules/settings-manager.js +299 -299
  25. package/dist/static/modules/socket-manager.js +170 -170
  26. package/dist/static/modules/state-manager.js +352 -352
  27. package/dist/static/modules/timer-controller.js +243 -243
  28. package/dist/static/modules/ui-helpers.js +246 -246
  29. package/dist/static/settings.html +426 -426
  30. package/dist/static/settings.js +767 -767
  31. package/dist/static/style.css +2156 -2156
  32. package/dist/static/terminals.html +357 -357
  33. package/dist/static/terminals.js +321 -321
  34. package/package.json +95 -95
@@ -1,124 +1,124 @@
1
- /**
2
- * app-core.js
3
- * 應用程式核心邏輯模組
4
- * 包含初始化、資料載入和核心功能聚合
5
- */
6
-
7
- import {
8
- setDialogTimeoutSeconds,
9
- setAutoReplyTimerSeconds,
10
- setMaxToolRounds,
11
- setDebugMode,
12
- } from "./state-manager.js";
13
-
14
- import { loadPrompts, autoLoadPinnedPrompts } from "./prompt-manager.js";
15
-
16
- import { loadAISettings, loadPreferences } from "./settings-manager.js";
17
-
18
- import { startAutoReplyTimer } from "./timer-controller.js";
19
-
20
- import {
21
- handleUserActivity as handleUserActivityImpl,
22
- submitFeedback as submitFeedbackImpl,
23
- } from "./feedback-handler.js";
24
-
25
- import {
26
- handleFileSelect as handleFileSelectImpl,
27
- handleFileDrop as handleFileDropImpl,
28
- handlePaste as handlePasteImpl,
29
- removeImage as removeImageImpl,
30
- clearImages as clearImagesImpl,
31
- } from "./image-handler.js";
32
-
33
- import { updateCharCount as updateCharCountImpl } from "./ui-helpers.js";
34
-
35
- /**
36
- * 載入初始資料
37
- */
38
- export async function loadInitialData() {
39
- try {
40
- // 首先從伺服器讀取配置,包括 MCP_DIALOG_TIMEOUT
41
- await loadServerConfig();
42
-
43
- // 載入並顯示版本號
44
- await loadVersion();
45
-
46
- // 載入提示詞
47
- await loadPrompts();
48
-
49
- // 載入 AI 設定
50
- await loadAISettings();
51
-
52
- // 載入使用者偏好
53
- await loadPreferences();
54
-
55
- // 自動載入釘選提示詞
56
- await autoLoadPinnedPrompts();
57
-
58
- // 頁面載入完成後,啟動 300 秒計時器
59
- // 當倒數到 0 時自動啟動 AI 回應
60
- startAutoReplyTimer();
61
- } catch (error) {
62
- console.error("載入初始資料失敗:", error);
63
- // showToast("error", "載入失敗", "無法載入初始資料"); // showToast might not be available here if not imported
64
- }
65
- }
66
-
67
- /**
68
- * 載入伺服器配置
69
- */
70
- async function loadServerConfig() {
71
- try {
72
- const response = await fetch("/api/config");
73
- const data = await response.json();
74
-
75
- if (data.dialog_timeout) {
76
- // 伺服器返回的是秒,直接使用
77
- setDialogTimeoutSeconds(data.dialog_timeout);
78
- console.log(`從伺服器讀取 MCP_DIALOG_TIMEOUT: ${data.dialog_timeout}s`);
79
- }
80
- } catch (error) {
81
- console.error("載入伺服器配置失敗,使用預設值:", error);
82
- // 使用預設值 60 秒 (state-manager 中已預設)
83
- }
84
- }
85
-
86
- /**
87
- * 載入版本資訊
88
- */
89
- async function loadVersion() {
90
- try {
91
- const response = await fetch("/api/version");
92
- if (response.ok) {
93
- const data = await response.json();
94
- const versionDisplay = document.getElementById("version-display");
95
- if (versionDisplay && data.version) {
96
- versionDisplay.textContent = `v${data.version}`;
97
- }
98
- }
99
- } catch (error) {
100
- console.error("載入版本資訊失敗:", error);
101
- }
102
- }
103
-
104
- // 重新導出核心功能
105
- export const handleUserActivity = handleUserActivityImpl;
106
- export const submitFeedback = submitFeedbackImpl;
107
- export const handleFileSelect = handleFileSelectImpl;
108
- export const handleFileDrop = handleFileDropImpl;
109
- export const handlePaste = handlePasteImpl;
110
- export const removeImage = removeImageImpl;
111
- export const clearImages = clearImagesImpl;
112
- export const updateCharCount = updateCharCountImpl;
113
-
114
- export default {
115
- loadInitialData,
116
- handleUserActivity,
117
- submitFeedback,
118
- handleFileSelect,
119
- handleFileDrop,
120
- handlePaste,
121
- removeImage,
122
- clearImages,
123
- updateCharCount,
124
- };
1
+ /**
2
+ * app-core.js
3
+ * 應用程式核心邏輯模組
4
+ * 包含初始化、資料載入和核心功能聚合
5
+ */
6
+
7
+ import {
8
+ setDialogTimeoutSeconds,
9
+ setAutoReplyTimerSeconds,
10
+ setMaxToolRounds,
11
+ setDebugMode,
12
+ } from "./state-manager.js";
13
+
14
+ import { loadPrompts, autoLoadPinnedPrompts } from "./prompt-manager.js";
15
+
16
+ import { loadAISettings, loadPreferences } from "./settings-manager.js";
17
+
18
+ import { startAutoReplyTimer } from "./timer-controller.js";
19
+
20
+ import {
21
+ handleUserActivity as handleUserActivityImpl,
22
+ submitFeedback as submitFeedbackImpl,
23
+ } from "./feedback-handler.js";
24
+
25
+ import {
26
+ handleFileSelect as handleFileSelectImpl,
27
+ handleFileDrop as handleFileDropImpl,
28
+ handlePaste as handlePasteImpl,
29
+ removeImage as removeImageImpl,
30
+ clearImages as clearImagesImpl,
31
+ } from "./image-handler.js";
32
+
33
+ import { updateCharCount as updateCharCountImpl } from "./ui-helpers.js";
34
+
35
+ /**
36
+ * 載入初始資料
37
+ */
38
+ export async function loadInitialData() {
39
+ try {
40
+ // 首先從伺服器讀取配置,包括 MCP_DIALOG_TIMEOUT
41
+ await loadServerConfig();
42
+
43
+ // 載入並顯示版本號
44
+ await loadVersion();
45
+
46
+ // 載入提示詞
47
+ await loadPrompts();
48
+
49
+ // 載入 AI 設定
50
+ await loadAISettings();
51
+
52
+ // 載入使用者偏好
53
+ await loadPreferences();
54
+
55
+ // 自動載入釘選提示詞
56
+ await autoLoadPinnedPrompts();
57
+
58
+ // 頁面載入完成後,啟動 300 秒計時器
59
+ // 當倒數到 0 時自動啟動 AI 回應
60
+ startAutoReplyTimer();
61
+ } catch (error) {
62
+ console.error("載入初始資料失敗:", error);
63
+ // showToast("error", "載入失敗", "無法載入初始資料"); // showToast might not be available here if not imported
64
+ }
65
+ }
66
+
67
+ /**
68
+ * 載入伺服器配置
69
+ */
70
+ async function loadServerConfig() {
71
+ try {
72
+ const response = await fetch("/api/config");
73
+ const data = await response.json();
74
+
75
+ if (data.dialog_timeout) {
76
+ // 伺服器返回的是秒,直接使用
77
+ setDialogTimeoutSeconds(data.dialog_timeout);
78
+ console.log(`從伺服器讀取 MCP_DIALOG_TIMEOUT: ${data.dialog_timeout}s`);
79
+ }
80
+ } catch (error) {
81
+ console.error("載入伺服器配置失敗,使用預設值:", error);
82
+ // 使用預設值 60 秒 (state-manager 中已預設)
83
+ }
84
+ }
85
+
86
+ /**
87
+ * 載入版本資訊
88
+ */
89
+ async function loadVersion() {
90
+ try {
91
+ const response = await fetch("/api/version");
92
+ if (response.ok) {
93
+ const data = await response.json();
94
+ const versionDisplay = document.getElementById("version-display");
95
+ if (versionDisplay && data.version) {
96
+ versionDisplay.textContent = `v${data.version}`;
97
+ }
98
+ }
99
+ } catch (error) {
100
+ console.error("載入版本資訊失敗:", error);
101
+ }
102
+ }
103
+
104
+ // 重新導出核心功能
105
+ export const handleUserActivity = handleUserActivityImpl;
106
+ export const submitFeedback = submitFeedbackImpl;
107
+ export const handleFileSelect = handleFileSelectImpl;
108
+ export const handleFileDrop = handleFileDropImpl;
109
+ export const handlePaste = handlePasteImpl;
110
+ export const removeImage = removeImageImpl;
111
+ export const clearImages = clearImagesImpl;
112
+ export const updateCharCount = updateCharCountImpl;
113
+
114
+ export default {
115
+ loadInitialData,
116
+ handleUserActivity,
117
+ submitFeedback,
118
+ handleFileSelect,
119
+ handleFileDrop,
120
+ handlePaste,
121
+ removeImage,
122
+ clearImages,
123
+ updateCharCount,
124
+ };