@peers-app/peers-ui 0.14.0 → 0.15.0
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.
- package/.github/workflows/publish.yml +8 -5
- package/babel.config.js +4 -4
- package/biome.json +191 -0
- package/dist/command-palette/command-palette-ui.d.ts +1 -2
- package/dist/command-palette/command-palette-ui.js +175 -244
- package/dist/command-palette/command-palette.js +65 -64
- package/dist/components/chat-overlay.d.ts +2 -2
- package/dist/components/chat-overlay.js +160 -217
- package/dist/components/checkbox.d.ts +5 -4
- package/dist/components/checkbox.js +4 -7
- package/dist/components/group-switcher.d.ts +1 -2
- package/dist/components/group-switcher.js +119 -159
- package/dist/components/input-date.d.ts +3 -3
- package/dist/components/input-date.js +6 -6
- package/dist/components/input-number.d.ts +7 -6
- package/dist/components/input-number.js +25 -20
- package/dist/components/input.d.ts +5 -4
- package/dist/components/input.js +4 -7
- package/dist/components/inverse-lazy-list.d.ts +3 -3
- package/dist/components/inverse-lazy-list.js +13 -47
- package/dist/components/io-schema-values.d.ts +5 -6
- package/dist/components/io-schema-values.js +28 -65
- package/dist/components/io-schema.d.ts +4 -5
- package/dist/components/io-schema.js +42 -79
- package/dist/components/lazy-list.d.ts +3 -3
- package/dist/components/lazy-list.js +38 -58
- package/dist/components/list-screen.d.ts +3 -8
- package/dist/components/list-screen.js +28 -23
- package/dist/components/loading-indicator.d.ts +1 -2
- package/dist/components/loading-indicator.js +2 -6
- package/dist/components/markdown-editor/autolink-plugin.js +5 -8
- package/dist/components/markdown-editor/editor-inline.d.ts +2 -3
- package/dist/components/markdown-editor/editor-inline.js +2 -6
- package/dist/components/markdown-editor/editor.d.ts +6 -6
- package/dist/components/markdown-editor/editor.js +9 -19
- package/dist/components/markdown-editor/markdown-plugin.d.ts +1 -1
- package/dist/components/markdown-editor/markdown-plugin.js +20 -21
- package/dist/components/markdown-editor/mention-node.d.ts +2 -2
- package/dist/components/markdown-editor/mention-node.js +24 -24
- package/dist/components/markdown-editor/mentions-plugin.d.ts +2 -2
- package/dist/components/markdown-editor/mentions-plugin.js +61 -62
- package/dist/components/markdown-editor/theme.js +28 -28
- package/dist/components/markdown-editor/toolbar.d.ts +2 -3
- package/dist/components/markdown-editor/toolbar.js +32 -49
- package/dist/components/markdown-with-mentions.d.ts +1 -1
- package/dist/components/markdown-with-mentions.js +43 -43
- package/dist/components/message-logs/message-logs.d.ts +1 -2
- package/dist/components/message-logs/message-logs.js +91 -116
- package/dist/components/messages/avatar.d.ts +3 -4
- package/dist/components/messages/avatar.js +37 -46
- package/dist/components/messages/channel-message-list.d.ts +5 -6
- package/dist/components/messages/channel-message-list.js +34 -34
- package/dist/components/messages/channel-view.d.ts +1 -2
- package/dist/components/messages/channel-view.js +23 -57
- package/dist/components/messages/message-compose.d.ts +3 -4
- package/dist/components/messages/message-compose.js +27 -38
- package/dist/components/messages/message-display.d.ts +2 -3
- package/dist/components/messages/message-display.js +42 -95
- package/dist/components/messages/thread-message-list.d.ts +4 -5
- package/dist/components/messages/thread-message-list.js +29 -29
- package/dist/components/router.d.ts +1 -2
- package/dist/components/router.js +58 -66
- package/dist/components/save-button.d.ts +3 -3
- package/dist/components/save-button.js +23 -33
- package/dist/components/sortable-list.d.ts +11 -12
- package/dist/components/sortable-list.js +42 -22
- package/dist/components/tabs.d.ts +3 -3
- package/dist/components/tabs.js +16 -47
- package/dist/components/tooltip.d.ts +4 -4
- package/dist/components/tooltip.js +4 -9
- package/dist/components/trust-level-badge.d.ts +2 -3
- package/dist/components/trust-level-badge.js +16 -16
- package/dist/components/trust-level-dropdown.d.ts +3 -4
- package/dist/components/trust-level-dropdown.js +32 -55
- package/dist/components/typeahead.d.ts +3 -3
- package/dist/components/typeahead.js +48 -89
- package/dist/components/voice-indicator.d.ts +2 -2
- package/dist/components/voice-indicator.js +93 -106
- package/dist/components/voice-subscribe-events.d.ts +32 -0
- package/dist/components/voice-subscribe-events.js +2 -0
- package/dist/globals.d.ts +3 -5
- package/dist/globals.js +22 -33
- package/dist/hooks.d.ts +5 -5
- package/dist/hooks.js +22 -12
- package/dist/hooks.test.js +129 -145
- package/dist/index.d.ts +9 -8
- package/dist/index.js +13 -12
- package/dist/mention-configs.d.ts +2 -2
- package/dist/mention-configs.js +55 -42
- package/dist/screens/assistants/assistant-config.d.ts +2 -3
- package/dist/screens/assistants/assistant-config.js +9 -22
- package/dist/screens/assistants/assistant-details.d.ts +1 -2
- package/dist/screens/assistants/assistant-details.js +13 -28
- package/dist/screens/assistants/assistant-info.d.ts +2 -3
- package/dist/screens/assistants/assistant-info.js +3 -17
- package/dist/screens/assistants/assistant-list.d.ts +1 -2
- package/dist/screens/assistants/assistant-list.js +15 -56
- package/dist/screens/assistants/assistant-tools.d.ts +2 -3
- package/dist/screens/assistants/assistant-tools.js +10 -24
- package/dist/screens/console-logs/console-logs-list.d.ts +1 -2
- package/dist/screens/console-logs/console-logs-list.js +130 -134
- package/dist/screens/console-logs/log-display.d.ts +2 -3
- package/dist/screens/console-logs/log-display.js +40 -42
- package/dist/screens/console-logs/log-filters.d.ts +1 -2
- package/dist/screens/console-logs/log-filters.js +2 -24
- package/dist/screens/console-logs/mobile-log-card.d.ts +2 -3
- package/dist/screens/console-logs/mobile-log-card.js +64 -67
- package/dist/screens/console-logs/resizable-table-header.d.ts +1 -2
- package/dist/screens/console-logs/resizable-table-header.js +31 -67
- package/dist/screens/contacts/contact-details.d.ts +1 -2
- package/dist/screens/contacts/contact-details.js +16 -46
- package/dist/screens/contacts/contact-list.d.ts +1 -2
- package/dist/screens/contacts/contact-list.js +44 -103
- package/dist/screens/contacts/index.d.ts +4 -4
- package/dist/screens/contacts/index.js +1 -1
- package/dist/screens/contacts/user-connect.d.ts +1 -2
- package/dist/screens/contacts/user-connect.js +85 -186
- package/dist/screens/data-explorer/data-explorer.d.ts +1 -2
- package/dist/screens/data-explorer/data-explorer.js +61 -181
- package/dist/screens/data-explorer/index.d.ts +2 -2
- package/dist/screens/data-explorer/query-executor.d.ts +1 -2
- package/dist/screens/data-explorer/query-executor.js +56 -166
- package/dist/screens/groups/group-details.d.ts +1 -2
- package/dist/screens/groups/group-details.js +27 -122
- package/dist/screens/groups/group-invite-listener.d.ts +2 -3
- package/dist/screens/groups/group-invite-listener.js +8 -104
- package/dist/screens/groups/group-list.d.ts +1 -2
- package/dist/screens/groups/group-list.js +56 -133
- package/dist/screens/groups/group-members.d.ts +2 -3
- package/dist/screens/groups/group-members.js +62 -132
- package/dist/screens/groups/index.d.ts +4 -4
- package/dist/screens/groups/index.js +1 -1
- package/dist/screens/join-group/index.d.ts +2 -2
- package/dist/screens/join-group/join-group.d.ts +1 -2
- package/dist/screens/join-group/join-group.js +9 -109
- package/dist/screens/network-viewer/connection-troubleshooter.d.ts +2 -3
- package/dist/screens/network-viewer/connection-troubleshooter.js +89 -193
- package/dist/screens/network-viewer/cpu-usage-graph.d.ts +1 -2
- package/dist/screens/network-viewer/cpu-usage-graph.js +60 -99
- package/dist/screens/network-viewer/device-details-modal.d.ts +1 -2
- package/dist/screens/network-viewer/device-details-modal.js +25 -177
- package/dist/screens/network-viewer/group-details-modal.d.ts +1 -2
- package/dist/screens/network-viewer/group-details-modal.js +31 -142
- package/dist/screens/network-viewer/index.d.ts +4 -4
- package/dist/screens/network-viewer/index.js +3 -3
- package/dist/screens/network-viewer/network-viewer-ipc.d.ts +22 -0
- package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
- package/dist/screens/network-viewer/network-viewer.d.ts +1 -2
- package/dist/screens/network-viewer/network-viewer.js +91 -296
- package/dist/screens/network-viewer/usage-graph.d.ts +1 -2
- package/dist/screens/network-viewer/usage-graph.js +78 -110
- package/dist/screens/packages/package-details.d.ts +1 -2
- package/dist/screens/packages/package-details.js +35 -41
- package/dist/screens/packages/package-info.d.ts +2 -2
- package/dist/screens/packages/package-info.js +33 -86
- package/dist/screens/packages/package-list.d.ts +1 -2
- package/dist/screens/packages/package-list.js +42 -106
- package/dist/screens/packages/package-new-local.d.ts +1 -2
- package/dist/screens/packages/package-new-local.js +13 -19
- package/dist/screens/packages/package-versions.d.ts +2 -3
- package/dist/screens/packages/package-versions.js +29 -96
- package/dist/screens/peer-types/peer-type-details.d.ts +3 -4
- package/dist/screens/peer-types/peer-type-details.js +26 -78
- package/dist/screens/peer-types/peer-type-list.d.ts +1 -2
- package/dist/screens/peer-types/peer-type-list.js +13 -24
- package/dist/screens/search/global-search.d.ts +1 -2
- package/dist/screens/search/global-search.js +104 -182
- package/dist/screens/settings/color-mode-dropdown.d.ts +3 -4
- package/dist/screens/settings/color-mode-dropdown.js +18 -37
- package/dist/screens/settings/settings-page.d.ts +1 -1
- package/dist/screens/settings/settings-page.js +86 -213
- package/dist/screens/settings/voice-settings-agent.d.ts +1 -1
- package/dist/screens/settings/voice-settings-agent.js +7 -44
- package/dist/screens/settings/voice-settings-api-keys.d.ts +2 -2
- package/dist/screens/settings/voice-settings-api-keys.js +2 -29
- package/dist/screens/settings/voice-settings-output.d.ts +2 -2
- package/dist/screens/settings/voice-settings-output.js +2 -40
- package/dist/screens/settings/voice-settings-providers.d.ts +2 -2
- package/dist/screens/settings/voice-settings-providers.js +2 -19
- package/dist/screens/settings/voice-settings-types.d.ts +4 -4
- package/dist/screens/settings/voice-settings-types.js +31 -31
- package/dist/screens/settings/voice-settings-wake-word.d.ts +2 -2
- package/dist/screens/settings/voice-settings-wake-word.js +2 -33
- package/dist/screens/settings/voice-settings.d.ts +1 -1
- package/dist/screens/settings/voice-settings.js +35 -112
- package/dist/screens/setup-user.d.ts +1 -2
- package/dist/screens/setup-user.js +38 -116
- package/dist/screens/tools/tool-code.d.ts +2 -3
- package/dist/screens/tools/tool-code.js +9 -13
- package/dist/screens/tools/tool-details.d.ts +1 -2
- package/dist/screens/tools/tool-details.js +26 -39
- package/dist/screens/tools/tool-info.d.ts +2 -3
- package/dist/screens/tools/tool-info.js +9 -48
- package/dist/screens/tools/tool-list.d.ts +1 -2
- package/dist/screens/tools/tool-list.js +33 -65
- package/dist/screens/tools/tool-schema.d.ts +2 -3
- package/dist/screens/tools/tool-schema.js +2 -13
- package/dist/screens/tools/tool-test-details.d.ts +1 -2
- package/dist/screens/tools/tool-test-details.js +12 -28
- package/dist/screens/tools/tool-test-list.d.ts +1 -2
- package/dist/screens/tools/tool-test-list.js +17 -56
- package/dist/screens/variables/variable-details.d.ts +1 -2
- package/dist/screens/variables/variable-details.js +19 -86
- package/dist/screens/variables/variable-list.d.ts +1 -2
- package/dist/screens/variables/variable-list.js +16 -27
- package/dist/screens/welcome-modal.d.ts +1 -2
- package/dist/screens/welcome-modal.js +44 -111
- package/dist/screens/workflows/workflow-details.d.ts +1 -2
- package/dist/screens/workflows/workflow-details.js +17 -31
- package/dist/screens/workflows/workflow-info.d.ts +2 -3
- package/dist/screens/workflows/workflow-info.js +2 -9
- package/dist/screens/workflows/workflow-instructions.d.ts +2 -3
- package/dist/screens/workflows/workflow-instructions.js +23 -55
- package/dist/screens/workflows/workflow-list.d.ts +1 -2
- package/dist/screens/workflows/workflow-list.js +23 -62
- package/dist/setupTests.d.ts +1 -1
- package/dist/setupTests.js +10 -11
- package/dist/system-apps/assistants.app.d.ts +1 -1
- package/dist/system-apps/assistants.app.js +3 -3
- package/dist/system-apps/console-logs.app.d.ts +1 -1
- package/dist/system-apps/console-logs.app.js +3 -3
- package/dist/system-apps/contacts.app.d.ts +1 -1
- package/dist/system-apps/contacts.app.js +4 -4
- package/dist/system-apps/data-explorer.app.d.ts +1 -1
- package/dist/system-apps/data-explorer.app.js +4 -4
- package/dist/system-apps/groups.app.d.ts +1 -1
- package/dist/system-apps/groups.app.js +4 -4
- package/dist/system-apps/index.d.ts +17 -17
- package/dist/system-apps/index.js +52 -52
- package/dist/system-apps/join-group.app.d.ts +1 -1
- package/dist/system-apps/join-group.app.js +4 -4
- package/dist/system-apps/mobile-settings.app.d.ts +1 -1
- package/dist/system-apps/mobile-settings.app.js +3 -3
- package/dist/system-apps/network-viewer.app.d.ts +1 -1
- package/dist/system-apps/network-viewer.app.js +4 -4
- package/dist/system-apps/packages.app.d.ts +1 -1
- package/dist/system-apps/packages.app.js +3 -3
- package/dist/system-apps/search.app.d.ts +1 -1
- package/dist/system-apps/search.app.js +4 -4
- package/dist/system-apps/settings.app.d.ts +1 -1
- package/dist/system-apps/settings.app.js +3 -3
- package/dist/system-apps/threads.app.d.ts +1 -1
- package/dist/system-apps/threads.app.js +3 -3
- package/dist/system-apps/tools.app.d.ts +1 -1
- package/dist/system-apps/tools.app.js +3 -3
- package/dist/system-apps/types.app.d.ts +1 -1
- package/dist/system-apps/types.app.js +3 -3
- package/dist/system-apps/variables.app.d.ts +1 -1
- package/dist/system-apps/variables.app.js +3 -3
- package/dist/system-apps/workflows.app.d.ts +1 -1
- package/dist/system-apps/workflows.app.js +3 -3
- package/dist/tabs-layout/tabs-layout.d.ts +2 -3
- package/dist/tabs-layout/tabs-layout.js +215 -246
- package/dist/tabs-layout/tabs-state.d.ts +2 -2
- package/dist/tabs-layout/tabs-state.js +73 -61
- package/dist/ui-defaults/index.d.ts +2 -2
- package/dist/ui-defaults/list-screen.d.ts +2 -3
- package/dist/ui-defaults/list-screen.js +33 -37
- package/dist/ui-defaults/markdown-field.js +24 -56
- package/dist/ui-router/routes-loader.d.ts +1 -1
- package/dist/ui-router/routes-loader.js +17 -13
- package/dist/ui-router/ui-loader.d.ts +6 -6
- package/dist/ui-router/ui-loader.js +172 -268
- package/dist/utils.js +49 -39
- package/jest.config.js +16 -16
- package/package.json +16 -14
- package/src/command-palette/command-palette-ui.tsx +261 -237
- package/src/command-palette/command-palette.ts +81 -78
- package/src/components/chat-overlay.tsx +366 -261
- package/src/components/checkbox.tsx +15 -12
- package/src/components/group-switcher.tsx +150 -105
- package/src/components/input-date.tsx +17 -16
- package/src/components/input-number.tsx +47 -31
- package/src/components/input.tsx +15 -12
- package/src/components/inverse-lazy-list.tsx +14 -13
- package/src/components/io-schema-values.tsx +51 -69
- package/src/components/io-schema.tsx +94 -69
- package/src/components/lazy-list.tsx +51 -34
- package/src/components/list-screen.tsx +51 -35
- package/src/components/loading-indicator.tsx +2 -4
- package/src/components/markdown-editor/autolink-plugin.tsx +4 -11
- package/src/components/markdown-editor/editor-inline.tsx +3 -4
- package/src/components/markdown-editor/editor.tsx +53 -51
- package/src/components/markdown-editor/markdown-plugin.tsx +48 -40
- package/src/components/markdown-editor/mention-node.ts +39 -38
- package/src/components/markdown-editor/mentions-plugin.tsx +99 -101
- package/src/components/markdown-editor/theme.ts +28 -29
- package/src/components/markdown-editor/toolbar.tsx +53 -47
- package/src/components/markdown-with-mentions.tsx +56 -46
- package/src/components/message-logs/message-logs.tsx +225 -165
- package/src/components/messages/avatar.tsx +70 -52
- package/src/components/messages/channel-message-list.tsx +80 -68
- package/src/components/messages/channel-view.tsx +34 -33
- package/src/components/messages/message-compose.tsx +84 -67
- package/src/components/messages/message-display.tsx +103 -89
- package/src/components/messages/thread-message-list.tsx +53 -44
- package/src/components/router.tsx +42 -43
- package/src/components/save-button.tsx +43 -39
- package/src/components/sortable-list.tsx +77 -49
- package/src/components/tabs.tsx +31 -31
- package/src/components/tooltip.tsx +21 -28
- package/src/components/trust-level-badge.tsx +15 -11
- package/src/components/trust-level-dropdown.tsx +49 -19
- package/src/components/typeahead.tsx +57 -59
- package/src/components/voice-indicator.tsx +158 -141
- package/src/components/voice-subscribe-events.ts +20 -0
- package/src/globals.tsx +42 -40
- package/src/hooks.test.tsx +141 -134
- package/src/hooks.ts +80 -48
- package/src/index.tsx +17 -10
- package/src/mention-configs.ts +122 -68
- package/src/screens/assistants/assistant-config.tsx +28 -18
- package/src/screens/assistants/assistant-details.tsx +35 -36
- package/src/screens/assistants/assistant-info.tsx +16 -11
- package/src/screens/assistants/assistant-list.tsx +37 -34
- package/src/screens/assistants/assistant-tools.tsx +41 -20
- package/src/screens/console-logs/console-logs-list.tsx +173 -140
- package/src/screens/console-logs/log-display.tsx +65 -38
- package/src/screens/console-logs/log-filters.tsx +4 -3
- package/src/screens/console-logs/mobile-log-card.tsx +78 -71
- package/src/screens/console-logs/resizable-table-header.tsx +29 -21
- package/src/screens/contacts/contact-details.tsx +29 -30
- package/src/screens/contacts/contact-list.tsx +71 -60
- package/src/screens/contacts/index.ts +5 -5
- package/src/screens/contacts/user-connect.tsx +177 -171
- package/src/screens/data-explorer/data-explorer.tsx +134 -98
- package/src/screens/data-explorer/index.ts +2 -3
- package/src/screens/data-explorer/query-executor.tsx +90 -80
- package/src/screens/groups/group-details.tsx +120 -101
- package/src/screens/groups/group-invite-listener.tsx +34 -37
- package/src/screens/groups/group-list.tsx +119 -103
- package/src/screens/groups/group-members.tsx +225 -164
- package/src/screens/groups/index.ts +5 -6
- package/src/screens/join-group/index.ts +2 -2
- package/src/screens/join-group/join-group.tsx +41 -39
- package/src/screens/network-viewer/connection-troubleshooter.tsx +145 -104
- package/src/screens/network-viewer/cpu-usage-graph.tsx +39 -43
- package/src/screens/network-viewer/device-details-modal.tsx +46 -59
- package/src/screens/network-viewer/group-details-modal.tsx +68 -49
- package/src/screens/network-viewer/index.ts +4 -5
- package/src/screens/network-viewer/network-viewer-ipc.ts +23 -0
- package/src/screens/network-viewer/network-viewer.tsx +261 -236
- package/src/screens/network-viewer/usage-graph.tsx +57 -49
- package/src/screens/packages/package-details.tsx +43 -35
- package/src/screens/packages/package-info.tsx +107 -66
- package/src/screens/packages/package-list.tsx +175 -98
- package/src/screens/packages/package-new-local.tsx +28 -26
- package/src/screens/packages/package-versions.tsx +102 -77
- package/src/screens/peer-types/peer-type-details.tsx +60 -50
- package/src/screens/peer-types/peer-type-list.tsx +20 -30
- package/src/screens/search/global-search.tsx +153 -137
- package/src/screens/settings/color-mode-dropdown.tsx +52 -35
- package/src/screens/settings/settings-page.tsx +215 -141
- package/src/screens/settings/voice-settings-agent.tsx +13 -12
- package/src/screens/settings/voice-settings-api-keys.tsx +14 -12
- package/src/screens/settings/voice-settings-output.tsx +12 -11
- package/src/screens/settings/voice-settings-providers.tsx +7 -3
- package/src/screens/settings/voice-settings-types.ts +52 -49
- package/src/screens/settings/voice-settings-wake-word.tsx +25 -9
- package/src/screens/settings/voice-settings.tsx +66 -43
- package/src/screens/setup-user.tsx +88 -41
- package/src/screens/tools/tool-code.tsx +12 -17
- package/src/screens/tools/tool-details.tsx +28 -28
- package/src/screens/tools/tool-info.tsx +14 -19
- package/src/screens/tools/tool-list.tsx +58 -40
- package/src/screens/tools/tool-schema.tsx +16 -9
- package/src/screens/tools/tool-test-details.tsx +11 -22
- package/src/screens/tools/tool-test-list.tsx +29 -30
- package/src/screens/variables/variable-details.tsx +63 -51
- package/src/screens/variables/variable-list.tsx +29 -30
- package/src/screens/welcome-modal.tsx +68 -48
- package/src/screens/workflows/workflow-details.tsx +40 -30
- package/src/screens/workflows/workflow-info.tsx +4 -11
- package/src/screens/workflows/workflow-instructions.tsx +35 -28
- package/src/screens/workflows/workflow-list.tsx +50 -40
- package/src/setupTests.ts +14 -13
- package/src/system-apps/assistants.app.ts +5 -5
- package/src/system-apps/console-logs.app.ts +4 -4
- package/src/system-apps/contacts.app.ts +6 -6
- package/src/system-apps/data-explorer.app.ts +5 -5
- package/src/system-apps/groups.app.ts +6 -6
- package/src/system-apps/index.ts +49 -49
- package/src/system-apps/join-group.app.ts +5 -5
- package/src/system-apps/mobile-settings.app.ts +4 -5
- package/src/system-apps/network-viewer.app.ts +5 -5
- package/src/system-apps/packages.app.ts +5 -5
- package/src/system-apps/search.app.ts +6 -6
- package/src/system-apps/settings.app.ts +5 -5
- package/src/system-apps/threads.app.ts +5 -5
- package/src/system-apps/tools.app.ts +5 -5
- package/src/system-apps/types.app.ts +5 -5
- package/src/system-apps/variables.app.ts +5 -5
- package/src/system-apps/workflows.app.ts +5 -5
- package/src/tabs-layout/tabs-layout.tsx +345 -254
- package/src/tabs-layout/tabs-state.ts +100 -81
- package/src/ui-defaults/index.ts +2 -3
- package/src/ui-defaults/list-screen.tsx +45 -40
- package/src/ui-defaults/markdown-field.tsx +22 -26
- package/src/ui-router/routes-loader.ts +40 -24
- package/src/ui-router/ui-loader.tsx +312 -214
- package/src/utils.ts +68 -81
- package/tsconfig.json +5 -10
- package/dist/components/input-datetime.d.ts +0 -7
- package/dist/components/input-datetime.js +0 -35
- package/dist/components/lazy-sortable-list.d.ts +0 -29
- package/dist/components/lazy-sortable-list.js +0 -12
- package/dist/components/left-bar.d.ts +0 -5
- package/dist/components/left-bar.js +0 -207
- package/dist/components/main-content-container.d.ts +0 -2
- package/dist/components/main-content-container.js +0 -92
- package/dist/components/messages/thread-view.d.ts +0 -6
- package/dist/components/messages/thread-view.js +0 -174
- package/dist/components/off-canvas.d.ts +0 -13
- package/dist/components/off-canvas.js +0 -89
- package/dist/components/text-list-editor.tsx/text-list-editor.d.ts +0 -6
- package/dist/components/text-list-editor.tsx/text-list-editor.js +0 -13
- package/dist/components/top-bar.d.ts +0 -2
- package/dist/components/top-bar.js +0 -51
- package/dist/components/typeahead/mentions-plugin.d.ts +0 -7
- package/dist/components/typeahead/mentions-plugin.js +0 -203
- package/dist/components/typeahead/typeahead-editor.d.ts +0 -15
- package/dist/components/typeahead/typeahead-editor.js +0 -134
- package/dist/components/typeahead/typeahead.d.ts +0 -12
- package/dist/components/typeahead/typeahead.js +0 -94
- package/dist/screens/profile.d.ts +0 -2
- package/dist/screens/profile.js +0 -76
- package/src/components/input-datetime.tsx +0 -41
- package/src/components/lazy-sortable-list.tsx +0 -51
- package/src/components/left-bar.tsx +0 -322
- package/src/components/main-content-container.tsx +0 -79
- package/src/components/messages/thread-view.tsx +0 -214
- package/src/components/off-canvas.tsx +0 -83
- package/src/components/text-list-editor.tsx/text-list-editor.tsx +0 -13
- package/src/components/top-bar.tsx +0 -119
- package/src/components/typeahead/mentions-plugin.tsx +0 -265
- package/src/components/typeahead/typeahead-editor.tsx +0 -140
- package/src/components/typeahead/typeahead.tsx +0 -77
- package/src/screens/profile.tsx +0 -75
package/src/index.tsx
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
export * from "./hooks";
|
|
2
|
-
|
|
3
|
-
export * from "./tabs-layout/tabs-layout";
|
|
4
|
-
export { activeTabId, activeTabs, TabState, updateActiveTabTitle, closeCurrentTab, goToTabPath } from "./tabs-layout/tabs-state";
|
|
5
|
-
export { mainContentPath } from "./globals";
|
|
6
|
-
export * from "./components/voice-indicator";
|
|
7
1
|
export * from "./components/chat-overlay";
|
|
8
|
-
export * from "./components/sortable-list";
|
|
9
|
-
export * from "./components/tabs";
|
|
10
2
|
export * from "./components/inverse-lazy-list";
|
|
3
|
+
export type { IEditorEffects, IMarkdownEditorProps } from "./components/markdown-editor/editor";
|
|
4
|
+
export { MarkdownEditor } from "./components/markdown-editor/editor";
|
|
11
5
|
export * from "./components/markdown-editor/editor-inline";
|
|
12
|
-
export * from "./components/markdown-
|
|
13
|
-
export * from "./components/
|
|
6
|
+
export * from "./components/markdown-with-mentions";
|
|
7
|
+
export * from "./components/sortable-list";
|
|
8
|
+
export * from "./components/tabs";
|
|
9
|
+
export * from "./components/voice-indicator";
|
|
10
|
+
export { mainContentPath } from "./globals";
|
|
11
|
+
export * from "./hooks";
|
|
12
|
+
export * from "./tabs-layout/tabs-layout";
|
|
13
|
+
export {
|
|
14
|
+
activeTabId,
|
|
15
|
+
activeTabs,
|
|
16
|
+
closeCurrentTab,
|
|
17
|
+
goToTabPath,
|
|
18
|
+
TabState,
|
|
19
|
+
updateActiveTabTitle,
|
|
20
|
+
} from "./tabs-layout/tabs-state";
|
package/src/mention-configs.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Assistants,
|
|
3
|
+
type IMentionData,
|
|
4
|
+
PeerTypes,
|
|
5
|
+
rpcClientCalls,
|
|
6
|
+
Tools,
|
|
7
|
+
Users,
|
|
8
|
+
Workflows,
|
|
9
|
+
} from "@peers-app/peers-sdk";
|
|
10
|
+
|
|
2
11
|
// import { MENTIONS_MAX_RESULTS } from "../client/components/markdown-editor/mentions-plugin";
|
|
3
12
|
|
|
4
13
|
const MENTIONS_MAX_RESULTS = 10;
|
|
@@ -10,101 +19,146 @@ export interface IMentionConfig {
|
|
|
10
19
|
query: (text: string) => Promise<IMentionData[]>;
|
|
11
20
|
getById: (id: string) => Promise<IMentionData | undefined>;
|
|
12
21
|
picture?: (data: IMentionData) => JSX.Element;
|
|
13
|
-
onClick?: (
|
|
22
|
+
onClick?: (data: IMentionData) => void;
|
|
14
23
|
}
|
|
15
24
|
|
|
16
25
|
export const toolMentionConfig: IMentionConfig = {
|
|
17
|
-
kind:
|
|
18
|
-
iconClass:
|
|
19
|
-
styleClass:
|
|
26
|
+
kind: "tool",
|
|
27
|
+
iconClass: "bi bi-tools",
|
|
28
|
+
styleClass: "mention-tool",
|
|
20
29
|
query: async (search: string) => {
|
|
21
|
-
const results = await Tools().list(
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
const results = await Tools().list(
|
|
31
|
+
{ name: { $matchWords: search } },
|
|
32
|
+
{ pageSize: MENTIONS_MAX_RESULTS },
|
|
33
|
+
);
|
|
34
|
+
return results.map((p) => ({
|
|
35
|
+
kind: "tool",
|
|
24
36
|
id: p.toolId,
|
|
25
|
-
name: p.name
|
|
37
|
+
name: p.name,
|
|
26
38
|
}));
|
|
27
39
|
},
|
|
28
|
-
getById:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
getById: (id) =>
|
|
41
|
+
Tools()
|
|
42
|
+
.get(id)
|
|
43
|
+
.then(
|
|
44
|
+
(item) =>
|
|
45
|
+
item && {
|
|
46
|
+
kind: "tool",
|
|
47
|
+
id: item.toolId,
|
|
48
|
+
name: item.name,
|
|
49
|
+
},
|
|
50
|
+
),
|
|
33
51
|
};
|
|
34
52
|
|
|
35
53
|
export const userMentionConfig: IMentionConfig = {
|
|
36
|
-
kind:
|
|
37
|
-
iconClass:
|
|
38
|
-
styleClass:
|
|
54
|
+
kind: "user",
|
|
55
|
+
iconClass: "bi-person-fill",
|
|
56
|
+
styleClass: "mention-user",
|
|
39
57
|
query: async (search: string) => {
|
|
40
|
-
return Users()
|
|
41
|
-
.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
58
|
+
return Users()
|
|
59
|
+
.list({ name: { $matchWords: search } }, { pageSize: MENTIONS_MAX_RESULTS })
|
|
60
|
+
.then((users) =>
|
|
61
|
+
users.map((user) => ({
|
|
62
|
+
kind: "user",
|
|
63
|
+
id: user.userId,
|
|
64
|
+
name: user.name,
|
|
65
|
+
})),
|
|
66
|
+
);
|
|
46
67
|
},
|
|
47
|
-
getById:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
68
|
+
getById: (id) =>
|
|
69
|
+
Users()
|
|
70
|
+
.get(id)
|
|
71
|
+
.then(
|
|
72
|
+
(item) =>
|
|
73
|
+
item && {
|
|
74
|
+
kind: "user",
|
|
75
|
+
id: item.userId,
|
|
76
|
+
name: item.name,
|
|
77
|
+
},
|
|
78
|
+
),
|
|
52
79
|
};
|
|
53
80
|
|
|
54
81
|
export const assistantMentionConfig: IMentionConfig = {
|
|
55
|
-
kind:
|
|
56
|
-
iconClass:
|
|
57
|
-
styleClass:
|
|
82
|
+
kind: "assistant",
|
|
83
|
+
iconClass: "bi bi-person-fill-gear",
|
|
84
|
+
styleClass: "mention-assistant",
|
|
58
85
|
query: async (search: string) => {
|
|
59
|
-
return Assistants()
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
86
|
+
return Assistants()
|
|
87
|
+
.list({ name: { $matchWords: search } }, { pageSize: MENTIONS_MAX_RESULTS })
|
|
88
|
+
.then((assistants) =>
|
|
89
|
+
assistants.map((assistant) => ({
|
|
90
|
+
kind: "assistant" as const,
|
|
91
|
+
id: assistant.assistantId,
|
|
92
|
+
name: assistant.name,
|
|
93
|
+
})),
|
|
94
|
+
);
|
|
65
95
|
},
|
|
66
|
-
getById:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
96
|
+
getById: (id) =>
|
|
97
|
+
Assistants()
|
|
98
|
+
.get(id)
|
|
99
|
+
.then(
|
|
100
|
+
(item) =>
|
|
101
|
+
item && {
|
|
102
|
+
kind: "assistant",
|
|
103
|
+
id: item.assistantId,
|
|
104
|
+
name: item.name,
|
|
105
|
+
},
|
|
106
|
+
),
|
|
71
107
|
};
|
|
72
108
|
|
|
73
109
|
export const workflowMentionConfig: IMentionConfig = {
|
|
74
|
-
kind:
|
|
75
|
-
iconClass:
|
|
76
|
-
styleClass:
|
|
110
|
+
kind: "workflow",
|
|
111
|
+
iconClass: "bi bi-database-fill-gear",
|
|
112
|
+
styleClass: "mention-workflow",
|
|
77
113
|
query: async (search: string) => {
|
|
78
|
-
return Workflows()
|
|
79
|
-
.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
114
|
+
return Workflows()
|
|
115
|
+
.list({ name: { $matchWords: search } }, { pageSize: MENTIONS_MAX_RESULTS })
|
|
116
|
+
.then((workflows) =>
|
|
117
|
+
workflows.map((workflow) => ({
|
|
118
|
+
kind: "workflow" as const,
|
|
119
|
+
id: workflow.workflowId,
|
|
120
|
+
name: workflow.name,
|
|
121
|
+
})),
|
|
122
|
+
);
|
|
84
123
|
},
|
|
85
|
-
getById:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
124
|
+
getById: (id) =>
|
|
125
|
+
Workflows()
|
|
126
|
+
.get(id)
|
|
127
|
+
.then(
|
|
128
|
+
(item) =>
|
|
129
|
+
item && {
|
|
130
|
+
kind: "workflow",
|
|
131
|
+
id: item.workflowId,
|
|
132
|
+
name: item.name,
|
|
133
|
+
},
|
|
134
|
+
),
|
|
90
135
|
};
|
|
91
136
|
|
|
92
137
|
export const valueTypeMentionConfig: IMentionConfig = {
|
|
93
|
-
kind:
|
|
94
|
-
iconClass:
|
|
138
|
+
kind: "type",
|
|
139
|
+
iconClass: "bi bi-code-square",
|
|
95
140
|
query: async (search: string) => {
|
|
96
|
-
const results = await PeerTypes().list(
|
|
97
|
-
|
|
98
|
-
|
|
141
|
+
const results = await PeerTypes().list(
|
|
142
|
+
{ name: { $matchWords: search } },
|
|
143
|
+
{ pageSize: MENTIONS_MAX_RESULTS },
|
|
144
|
+
);
|
|
145
|
+
return results.map((item) => ({
|
|
146
|
+
kind: "type",
|
|
99
147
|
id: item.peerTypeId,
|
|
100
|
-
name: item.name
|
|
148
|
+
name: item.name,
|
|
101
149
|
}));
|
|
102
150
|
},
|
|
103
|
-
getById:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
151
|
+
getById: (id) =>
|
|
152
|
+
PeerTypes()
|
|
153
|
+
.get(id)
|
|
154
|
+
.then(
|
|
155
|
+
(item) =>
|
|
156
|
+
item && {
|
|
157
|
+
kind: "type",
|
|
158
|
+
id: item.peerTypeId,
|
|
159
|
+
name: item.name,
|
|
160
|
+
},
|
|
161
|
+
),
|
|
108
162
|
onClick(data) {
|
|
109
163
|
rpcClientCalls.setClientPath(`peer-types/${data.id}`);
|
|
110
164
|
},
|
|
@@ -124,4 +178,4 @@ export const mentionConfigs = [
|
|
|
124
178
|
assistantMentionConfig,
|
|
125
179
|
workflowMentionConfig,
|
|
126
180
|
valueTypeMentionConfig,
|
|
127
|
-
];
|
|
181
|
+
];
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
type IAssistant,
|
|
3
|
+
type IDoc,
|
|
4
|
+
IOSchemaType,
|
|
5
|
+
type Observable,
|
|
6
|
+
Tools,
|
|
7
|
+
} from "@peers-app/peers-sdk";
|
|
3
8
|
import { IOSchemaValues } from "../../components/io-schema-values";
|
|
4
9
|
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
5
10
|
import { useObservable, usePromise } from "../../hooks";
|
|
@@ -17,8 +22,8 @@ export const AssistantConfig = (props: { assistant: IDoc<IAssistant> }) => {
|
|
|
17
22
|
|
|
18
23
|
if (assistantRunnerTool === null) {
|
|
19
24
|
return (
|
|
20
|
-
<div>
|
|
21
|
-
<div className=
|
|
25
|
+
<div>
|
|
26
|
+
<div className="mt-2">
|
|
22
27
|
<small>Assistant Runner Tool:</small>
|
|
23
28
|
<AssistantRunnersDropdown selectedToolId={assistant.qs.assistantRunnerToolId} />
|
|
24
29
|
</div>
|
|
@@ -26,30 +31,30 @@ export const AssistantConfig = (props: { assistant: IDoc<IAssistant> }) => {
|
|
|
26
31
|
);
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
assistantRunnerTool.configSchema = assistantRunnerTool.configSchema ?? {
|
|
34
|
+
assistantRunnerTool.configSchema = assistantRunnerTool.configSchema ?? {
|
|
30
35
|
type: IOSchemaType.complex,
|
|
31
|
-
fields: []
|
|
36
|
+
fields: [],
|
|
32
37
|
};
|
|
33
38
|
|
|
34
39
|
return (
|
|
35
40
|
<div>
|
|
36
|
-
|
|
37
|
-
<div className='mt-2'>
|
|
41
|
+
<div className="mt-2">
|
|
38
42
|
<small>Assistant Runner Tool:</small>
|
|
39
43
|
<AssistantRunnersDropdown selectedToolId={assistant.qs.assistantRunnerToolId} />
|
|
40
44
|
</div>
|
|
41
45
|
|
|
42
|
-
<IOSchemaValues
|
|
43
|
-
|
|
46
|
+
<IOSchemaValues
|
|
47
|
+
ioSchema={assistantRunnerTool.configSchema}
|
|
48
|
+
values={assistant.assistantRunnerConfig}
|
|
49
|
+
q={assistant.q}
|
|
50
|
+
/>
|
|
44
51
|
</div>
|
|
45
52
|
);
|
|
46
53
|
};
|
|
47
54
|
|
|
48
|
-
|
|
49
55
|
const AssistantRunnersDropdown = (props: { selectedToolId: Observable<string> }) => {
|
|
50
|
-
|
|
51
56
|
const [selectedToolId] = useObservable(props.selectedToolId);
|
|
52
|
-
|
|
57
|
+
|
|
53
58
|
const modelTools = usePromise(async () => {
|
|
54
59
|
const modelTools = await Tools().list({ isAssistantRunner: true });
|
|
55
60
|
return modelTools;
|
|
@@ -61,20 +66,25 @@ const AssistantRunnersDropdown = (props: { selectedToolId: Observable<string> })
|
|
|
61
66
|
|
|
62
67
|
return (
|
|
63
68
|
<div className="dropdown">
|
|
64
|
-
<button
|
|
65
|
-
|
|
69
|
+
<button
|
|
70
|
+
className="btn btn-secondary dropdown-toggle"
|
|
71
|
+
type="button"
|
|
72
|
+
data-bs-toggle="dropdown"
|
|
73
|
+
aria-expanded="false"
|
|
74
|
+
>
|
|
75
|
+
{modelTools.find((tool) => tool.toolId === selectedToolId)?.name ?? "Select Tool"}
|
|
66
76
|
</button>
|
|
67
77
|
<ul className="dropdown-menu">
|
|
68
|
-
{modelTools.map(tool => {
|
|
78
|
+
{modelTools.map((tool) => {
|
|
69
79
|
return (
|
|
70
80
|
<li key={tool.toolId} onClick={() => props.selectedToolId(tool.toolId)}>
|
|
71
81
|
{/* <button className="dropdown-item" type="button">Action</button> */}
|
|
72
82
|
{/* <MarkdownWithMentions content={tool.name} /> */}
|
|
73
83
|
<span className="dropdown-item">{tool.name}</span>
|
|
74
84
|
</li>
|
|
75
|
-
)
|
|
85
|
+
);
|
|
76
86
|
})}
|
|
77
87
|
</ul>
|
|
78
88
|
</div>
|
|
79
89
|
);
|
|
80
|
-
}
|
|
90
|
+
};
|
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
1
|
+
import {
|
|
2
|
+
Assistants,
|
|
3
|
+
groupPrimaryAssistantVar,
|
|
4
|
+
userPrimaryAssistantVar,
|
|
5
|
+
} from "@peers-app/peers-sdk";
|
|
6
|
+
import { Input } from "../../components/input";
|
|
7
|
+
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
8
|
+
import { SaveButton } from "../../components/save-button";
|
|
9
|
+
import { Tabs } from "../../components/tabs";
|
|
10
|
+
import { useObservable, usePromise } from "../../hooks";
|
|
11
|
+
import { updateActiveTabTitle } from "../../tabs-layout/tabs-state";
|
|
12
|
+
import { AssistantConfig } from "./assistant-config";
|
|
13
|
+
import { AssistantInfo } from "./assistant-info";
|
|
14
|
+
import { AssistantTools } from "./assistant-tools";
|
|
13
15
|
|
|
14
16
|
export const AssistantDetails = (props: { assistantId: string }) => {
|
|
15
|
-
|
|
16
17
|
const [userAssistantId] = useObservable(userPrimaryAssistantVar);
|
|
17
18
|
const [groupAssistantId] = useObservable(groupPrimaryAssistantVar);
|
|
18
19
|
|
|
19
|
-
const assistant = usePromise(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
const assistant = usePromise(
|
|
21
|
+
async () => {
|
|
22
|
+
const assistant = await Assistants().get(props.assistantId);
|
|
23
|
+
if (!assistant) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
updateActiveTabTitle(assistant.name || "Assistant");
|
|
27
|
+
return Assistants().initDoc(assistant);
|
|
28
|
+
},
|
|
29
|
+
undefined,
|
|
30
|
+
[props.assistantId],
|
|
31
|
+
);
|
|
27
32
|
|
|
28
33
|
if (assistant === null) {
|
|
29
34
|
return <div>Assistant not found with id of {props.assistantId}</div>;
|
|
@@ -34,8 +39,7 @@ export const AssistantDetails = (props: { assistantId: string }) => {
|
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
return (
|
|
37
|
-
<div className=
|
|
38
|
-
|
|
42
|
+
<div className="container-fluid p-3">
|
|
39
43
|
<div className="d-flex">
|
|
40
44
|
<div>
|
|
41
45
|
<h4>
|
|
@@ -44,20 +48,16 @@ export const AssistantDetails = (props: { assistantId: string }) => {
|
|
|
44
48
|
</div>
|
|
45
49
|
<div className="flex-grow-1">
|
|
46
50
|
<h4>
|
|
47
|
-
<Input
|
|
51
|
+
<Input
|
|
48
52
|
key={assistant.assistantId}
|
|
49
|
-
className=
|
|
50
|
-
style={{ width:
|
|
53
|
+
className="border border-0"
|
|
54
|
+
style={{ width: "100%", outline: "none", backgroundColor: "transparent" }}
|
|
51
55
|
value={assistant.qs.name}
|
|
52
56
|
/>
|
|
53
57
|
</h4>
|
|
54
58
|
</div>
|
|
55
59
|
<div className="">
|
|
56
|
-
|
|
57
|
-
<SaveButton
|
|
58
|
-
key={assistant.assistantId}
|
|
59
|
-
doc={assistant}
|
|
60
|
-
/>
|
|
60
|
+
<SaveButton key={assistant.assistantId} doc={assistant} />
|
|
61
61
|
</div>
|
|
62
62
|
</div>
|
|
63
63
|
|
|
@@ -65,7 +65,7 @@ export const AssistantDetails = (props: { assistantId: string }) => {
|
|
|
65
65
|
key={assistant.assistantId}
|
|
66
66
|
tabs={[
|
|
67
67
|
{
|
|
68
|
-
name:
|
|
68
|
+
name: "Info",
|
|
69
69
|
content: (
|
|
70
70
|
<AssistantInfo
|
|
71
71
|
assistant={assistant}
|
|
@@ -80,11 +80,10 @@ export const AssistantDetails = (props: { assistantId: string }) => {
|
|
|
80
80
|
/>
|
|
81
81
|
),
|
|
82
82
|
},
|
|
83
|
-
{ name:
|
|
84
|
-
{ name:
|
|
83
|
+
{ name: "Config", content: <AssistantConfig assistant={assistant} /> },
|
|
84
|
+
{ name: "Tools", content: <AssistantTools assistant={assistant} /> },
|
|
85
85
|
]}
|
|
86
86
|
/>
|
|
87
|
-
|
|
88
87
|
</div>
|
|
89
88
|
);
|
|
90
|
-
}
|
|
89
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { IAssistant, IDoc } from "@peers-app/peers-sdk";
|
|
2
|
-
import React from "react";
|
|
1
|
+
import type { IAssistant, IDoc, Observable } from "@peers-app/peers-sdk";
|
|
3
2
|
import { Input } from "../../components/input";
|
|
4
3
|
import { MarkdownEditorInline } from "../../components/markdown-editor/editor-inline";
|
|
5
4
|
|
|
@@ -12,11 +11,16 @@ interface AssistantInfoProps {
|
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
export const AssistantInfo = (props: AssistantInfoProps) => {
|
|
15
|
-
const {
|
|
14
|
+
const {
|
|
15
|
+
assistant,
|
|
16
|
+
isPrimaryAssistant,
|
|
17
|
+
isGroupPrimaryAssistant,
|
|
18
|
+
onSetPrimary,
|
|
19
|
+
onSetGroupPrimary,
|
|
20
|
+
} = props;
|
|
16
21
|
|
|
17
22
|
return (
|
|
18
23
|
<div>
|
|
19
|
-
|
|
20
24
|
<small>Name:</small>
|
|
21
25
|
<Input
|
|
22
26
|
value={assistant.qs.name}
|
|
@@ -26,7 +30,9 @@ export const AssistantInfo = (props: AssistantInfoProps) => {
|
|
|
26
30
|
/>
|
|
27
31
|
|
|
28
32
|
<div>
|
|
29
|
-
<label htmlFor="isPrimary" className="form-label small mt-2 me-2">
|
|
33
|
+
<label htmlFor="isPrimary" className="form-label small mt-2 me-2">
|
|
34
|
+
My Default Assistant:
|
|
35
|
+
</label>
|
|
30
36
|
<input
|
|
31
37
|
type="checkbox"
|
|
32
38
|
id="isPrimary"
|
|
@@ -36,7 +42,9 @@ export const AssistantInfo = (props: AssistantInfoProps) => {
|
|
|
36
42
|
</div>
|
|
37
43
|
|
|
38
44
|
<div>
|
|
39
|
-
<label htmlFor="isGroupPrimary" className="form-label small mt-2 me-2">
|
|
45
|
+
<label htmlFor="isGroupPrimary" className="form-label small mt-2 me-2">
|
|
46
|
+
Group Default Assistant:
|
|
47
|
+
</label>
|
|
40
48
|
<input
|
|
41
49
|
type="checkbox"
|
|
42
50
|
id="isGroupPrimary"
|
|
@@ -45,13 +53,10 @@ export const AssistantInfo = (props: AssistantInfoProps) => {
|
|
|
45
53
|
/>
|
|
46
54
|
</div>
|
|
47
55
|
|
|
48
|
-
<div className=
|
|
56
|
+
<div className="mt-2">
|
|
49
57
|
<small>Description:</small>
|
|
50
|
-
<MarkdownEditorInline
|
|
51
|
-
value={assistant.qs.description as any}
|
|
52
|
-
/>
|
|
58
|
+
<MarkdownEditorInline value={assistant.qs.description as Observable<string>} />
|
|
53
59
|
</div>
|
|
54
|
-
|
|
55
60
|
</div>
|
|
56
61
|
);
|
|
57
62
|
};
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
Assistants,
|
|
3
|
+
type IAssistant,
|
|
4
|
+
type ICursorIterable,
|
|
5
|
+
newid,
|
|
6
|
+
observable,
|
|
7
|
+
} from "@peers-app/peers-sdk";
|
|
8
|
+
import type React from "react";
|
|
9
|
+
import { useEffect, useState } from "react";
|
|
3
10
|
import { Input } from "../../components/input";
|
|
4
11
|
import { LazyList } from "../../components/lazy-list";
|
|
5
|
-
import { LoadingIndicator } from
|
|
6
|
-
import { MarkdownWithMentions } from
|
|
7
|
-
import { isDesktop, mainContentPath } from
|
|
12
|
+
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
13
|
+
import { MarkdownWithMentions } from "../../components/markdown-with-mentions";
|
|
14
|
+
import { isDesktop, mainContentPath } from "../../globals";
|
|
8
15
|
import { useObservable } from "../../hooks";
|
|
9
16
|
|
|
10
|
-
|
|
11
17
|
export const AssistantList = () => {
|
|
12
|
-
const [searchTextObs] = useState(() => observable(
|
|
18
|
+
const [searchTextObs] = useState(() => observable(""));
|
|
13
19
|
const [searchText] = useObservable(searchTextObs);
|
|
14
20
|
|
|
15
21
|
const [cursorObs] = useState(() => observable<ICursorIterable<IAssistant> | undefined>());
|
|
@@ -19,9 +25,12 @@ export const AssistantList = () => {
|
|
|
19
25
|
let cursor: ICursorIterable<IAssistant>;
|
|
20
26
|
const _searchText = searchText.trim();
|
|
21
27
|
if (_searchText) {
|
|
22
|
-
cursor = await Assistants().cursor(
|
|
28
|
+
cursor = await Assistants().cursor(
|
|
29
|
+
{ name: { $matchWords: _searchText } },
|
|
30
|
+
{ sortBy: ["-updatedAt"] },
|
|
31
|
+
);
|
|
23
32
|
} else {
|
|
24
|
-
cursor = await Assistants().cursor(undefined, { sortBy: [
|
|
33
|
+
cursor = await Assistants().cursor(undefined, { sortBy: ["-updatedAt"] });
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
cursorObs(cursor);
|
|
@@ -35,12 +44,12 @@ export const AssistantList = () => {
|
|
|
35
44
|
cursorId(newid());
|
|
36
45
|
});
|
|
37
46
|
return () => sub.dispose();
|
|
38
|
-
}, [
|
|
47
|
+
}, [cursorId, cursorObs, searchTextObs.subscribe]);
|
|
39
48
|
|
|
40
49
|
async function searchSubmit(evt: React.KeyboardEvent<HTMLInputElement>) {
|
|
41
50
|
if (evt.key !== "Enter") return;
|
|
42
51
|
if (!searchText.trim()) return;
|
|
43
|
-
|
|
52
|
+
const assistantName = searchText.trim();
|
|
44
53
|
const assistant = await Assistants().initRecord({
|
|
45
54
|
name: assistantName,
|
|
46
55
|
});
|
|
@@ -49,10 +58,10 @@ export const AssistantList = () => {
|
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
async function loadMore(loadedRecords: IAssistant[]): Promise<IAssistant[]> {
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
const moreMatches: IAssistant[] = [];
|
|
62
|
+
const cursor = cursorObs() || (await newCursor());
|
|
54
63
|
for await (const assistant of cursor) {
|
|
55
|
-
if (loadedRecords.find(a => a.assistantId === assistant.assistantId)) continue;
|
|
64
|
+
if (loadedRecords.find((a) => a.assistantId === assistant.assistantId)) continue;
|
|
56
65
|
moreMatches.push(assistant);
|
|
57
66
|
if (searchText.length && moreMatches.length > 5) break;
|
|
58
67
|
if (moreMatches.length >= 50) break;
|
|
@@ -64,14 +73,14 @@ export const AssistantList = () => {
|
|
|
64
73
|
}
|
|
65
74
|
|
|
66
75
|
return (
|
|
67
|
-
<div className=
|
|
68
|
-
<Input
|
|
69
|
-
value={searchTextObs}
|
|
70
|
-
className="form-control"
|
|
71
|
-
style={{ marginBottom: "10px" }}
|
|
76
|
+
<div className="container-fluid">
|
|
77
|
+
<Input
|
|
78
|
+
value={searchTextObs}
|
|
79
|
+
className="form-control"
|
|
80
|
+
style={{ marginBottom: "10px" }}
|
|
72
81
|
placeholder="Search or create new assistant"
|
|
73
|
-
autoFocus={isDesktop()
|
|
74
|
-
onKeyUp={evt => searchSubmit(evt)}
|
|
82
|
+
autoFocus={!!isDesktop()}
|
|
83
|
+
onKeyUp={(evt) => searchSubmit(evt)}
|
|
75
84
|
/>
|
|
76
85
|
|
|
77
86
|
<div className="peers-list-container">
|
|
@@ -80,23 +89,17 @@ export const AssistantList = () => {
|
|
|
80
89
|
loadMore={loadMore}
|
|
81
90
|
scrollThreshold={0.6}
|
|
82
91
|
renderItems={(assistants) => {
|
|
83
|
-
return assistants.map(assistant => {
|
|
92
|
+
return assistants.map((assistant) => {
|
|
84
93
|
return (
|
|
85
|
-
<div
|
|
86
|
-
key={assistant.assistantId}
|
|
87
|
-
className='container-fluid pb-4'
|
|
88
|
-
>
|
|
94
|
+
<div key={assistant.assistantId} className="container-fluid pb-4">
|
|
89
95
|
<i className="bi bi-person-fill-gear"></i>
|
|
90
|
-
<a href={`#assistants/${assistant.assistantId}`}>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<div style={{ paddingLeft: '20px' }}>
|
|
94
|
-
<MarkdownWithMentions content={assistant.description ?? ''} />
|
|
96
|
+
<a href={`#assistants/${assistant.assistantId}`}>{assistant.name}</a>
|
|
97
|
+
<div style={{ paddingLeft: "20px" }}>
|
|
98
|
+
<MarkdownWithMentions content={assistant.description ?? ""} />
|
|
95
99
|
</div>
|
|
96
|
-
|
|
97
100
|
</div>
|
|
98
|
-
)
|
|
99
|
-
})
|
|
101
|
+
);
|
|
102
|
+
});
|
|
100
103
|
}}
|
|
101
104
|
loadingIndicator={
|
|
102
105
|
<div className="d-flex justify-content-center" style={{ height: 200 }}>
|