mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-26 13:19:34 +07:00
📝 docs(bot): Auto sync agents & plugin to readme
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
[
|
||||
{
|
||||
"children": {
|
||||
"improvements": ["Refactor page and notebook document usage."]
|
||||
},
|
||||
"date": "2026-01-10",
|
||||
"version": "2.0.0-next.256"
|
||||
},
|
||||
{
|
||||
"children": {
|
||||
"fixes": ["Fix auto add group member crash."]
|
||||
|
||||
@@ -16,12 +16,12 @@ export function openFileSelector(handleFiles: (files: FileList) => void, accept
|
||||
input.multiple = false;
|
||||
|
||||
// Listen for file selection events
|
||||
input.onchange = (event) => {
|
||||
input.addEventListener('change', (event) => {
|
||||
const files = (event.target as HTMLInputElement)?.files;
|
||||
if (files && files.length > 0) {
|
||||
handleFiles(files);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// Trigger file selector
|
||||
input.click();
|
||||
|
||||
@@ -8,15 +8,15 @@ export enum ArtifactDisplayMode {
|
||||
// ============== Portal View Stack Types ==============
|
||||
|
||||
export enum PortalViewType {
|
||||
Home = 'home',
|
||||
Artifact = 'artifact',
|
||||
Document = 'document',
|
||||
Notebook = 'notebook',
|
||||
FilePreview = 'filePreview',
|
||||
MessageDetail = 'messageDetail',
|
||||
ToolUI = 'toolUI',
|
||||
Thread = 'thread',
|
||||
GroupThread = 'groupThread',
|
||||
Home = 'home',
|
||||
MessageDetail = 'messageDetail',
|
||||
Notebook = 'notebook',
|
||||
Thread = 'thread',
|
||||
ToolUI = 'toolUI',
|
||||
}
|
||||
|
||||
export interface PortalFile {
|
||||
@@ -27,38 +27,38 @@ export interface PortalFile {
|
||||
|
||||
export type PortalViewData =
|
||||
| { type: PortalViewType.Home }
|
||||
| { type: PortalViewType.Artifact; artifact: PortalArtifact }
|
||||
| { type: PortalViewType.Document; documentId: string }
|
||||
| { artifact: PortalArtifact; type: PortalViewType.Artifact }
|
||||
| { documentId: string; type: PortalViewType.Document }
|
||||
| { type: PortalViewType.Notebook }
|
||||
| { type: PortalViewType.FilePreview; file: PortalFile }
|
||||
| { type: PortalViewType.MessageDetail; messageId: string }
|
||||
| { type: PortalViewType.ToolUI; messageId: string; identifier: string }
|
||||
| { type: PortalViewType.Thread; threadId?: string; startMessageId?: string }
|
||||
| { type: PortalViewType.GroupThread; agentId: string };
|
||||
| { file: PortalFile; type: PortalViewType.FilePreview }
|
||||
| { messageId: string; type: PortalViewType.MessageDetail }
|
||||
| { identifier: string; messageId: string; type: PortalViewType.ToolUI }
|
||||
| { startMessageId?: string; threadId?: string; type: PortalViewType.Thread }
|
||||
| { agentId: string; type: PortalViewType.GroupThread };
|
||||
|
||||
// ============== Portal State ==============
|
||||
|
||||
export interface ChatPortalState {
|
||||
portalArtifactDisplayMode: ArtifactDisplayMode;
|
||||
portalStack: PortalViewData[];
|
||||
showPortal: boolean;
|
||||
|
||||
// Legacy fields (kept for backward compatibility during migration)
|
||||
// TODO: Remove after Phase 3 migration complete
|
||||
/** @deprecated Use portalStack instead */
|
||||
portalArtifact?: PortalArtifact;
|
||||
portalArtifactDisplayMode: ArtifactDisplayMode;
|
||||
/** @deprecated Use portalStack instead */
|
||||
portalDocumentId?: string;
|
||||
|
||||
/** @deprecated Use portalStack instead */
|
||||
portalFile?: PortalFile;
|
||||
/** @deprecated Use portalStack instead */
|
||||
portalMessageDetail?: string;
|
||||
portalStack: PortalViewData[];
|
||||
/** @deprecated Use portalStack instead */
|
||||
portalThreadId?: string;
|
||||
/** @deprecated Use portalStack instead */
|
||||
portalToolMessage?: { id: string; identifier: string };
|
||||
/** @deprecated Use portalStack instead */
|
||||
showNotebook?: boolean;
|
||||
showPortal: boolean;
|
||||
}
|
||||
|
||||
export const initialChatPortalState: ChatPortalState = {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { type PortalFile, type PortalViewData, PortalViewType } from './initialS
|
||||
|
||||
const currentView = (s: ChatStoreState): PortalViewData | null => {
|
||||
const { portalStack } = s;
|
||||
return portalStack[portalStack.length - 1] ?? null;
|
||||
return portalStack.at(-1) ?? null;
|
||||
};
|
||||
|
||||
const currentViewType = (s: ChatStoreState): PortalViewType | null => {
|
||||
@@ -109,10 +109,10 @@ const messageDetailId = (s: ChatStoreState): string | undefined => {
|
||||
// Tool UI / Plugin selectors
|
||||
const currentToolUI = (
|
||||
s: ChatStoreState,
|
||||
): { messageId: string; identifier: string } | undefined => {
|
||||
): { identifier: string; messageId: string } | undefined => {
|
||||
const view = getViewData(s, PortalViewType.ToolUI);
|
||||
if (view) {
|
||||
return { messageId: view.messageId, identifier: view.identifier };
|
||||
return { identifier: view.identifier, messageId: view.messageId };
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ import { type PortalViewData, PortalViewType } from '../initialState';
|
||||
// Helper to get current view
|
||||
const getCurrentView = (s: ChatStoreState): PortalViewData | null => {
|
||||
const { portalStack } = s;
|
||||
return portalStack[portalStack.length - 1] ?? null;
|
||||
return portalStack.at(-1) ?? null;
|
||||
};
|
||||
|
||||
// Check if current view is Thread
|
||||
|
||||
@@ -6,5 +6,5 @@ export {
|
||||
type EditorState,
|
||||
initialEditorState,
|
||||
} from './initialState';
|
||||
export { documentReducer, type DocumentDispatch } from './reducer';
|
||||
export { type DocumentDispatch, documentReducer } from './reducer';
|
||||
export { editorSelectors } from './selectors';
|
||||
|
||||
Reference in New Issue
Block a user