mirror of
https://github.com/rait-09/obsidian-agent-client.git
synced 2026-07-22 06:43:37 +00:00
fix: remove unnecessary type assertions in plugin.ts and ChatPanel.tsx
This commit is contained in:
parent
331b9dbaf0
commit
a5d8eeea68
2 changed files with 9 additions and 10 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import {
|
||||
Plugin,
|
||||
WorkspaceLeaf,
|
||||
WorkspaceSplit,
|
||||
Notice,
|
||||
requestUrl,
|
||||
} from "obsidian";
|
||||
|
|
@ -525,7 +524,7 @@ export default class AgentClientPlugin extends Plugin {
|
|||
const tabGroup = sidebarLeaf.parent;
|
||||
// Index is clamped by Obsidian, so a large value appends to the end
|
||||
return workspace.createLeafInParent(
|
||||
tabGroup as unknown as WorkspaceSplit,
|
||||
tabGroup,
|
||||
Number.MAX_SAFE_INTEGER,
|
||||
);
|
||||
}
|
||||
|
|
@ -652,7 +651,7 @@ export default class AgentClientPlugin extends Plugin {
|
|||
name: `Switch agent to ${agent.displayName}`,
|
||||
callback: () => {
|
||||
this.app.workspace.trigger(
|
||||
"agent-client:new-chat-requested" as "quit",
|
||||
"agent-client:new-chat-requested",
|
||||
this.lastActiveChatViewId,
|
||||
agent.id,
|
||||
);
|
||||
|
|
@ -667,7 +666,7 @@ export default class AgentClientPlugin extends Plugin {
|
|||
name: "Approve active permission",
|
||||
callback: () => {
|
||||
this.app.workspace.trigger(
|
||||
"agent-client:approve-active-permission" as "quit",
|
||||
"agent-client:approve-active-permission",
|
||||
this.lastActiveChatViewId,
|
||||
);
|
||||
},
|
||||
|
|
@ -678,7 +677,7 @@ export default class AgentClientPlugin extends Plugin {
|
|||
name: "Reject active permission",
|
||||
callback: () => {
|
||||
this.app.workspace.trigger(
|
||||
"agent-client:reject-active-permission" as "quit",
|
||||
"agent-client:reject-active-permission",
|
||||
this.lastActiveChatViewId,
|
||||
);
|
||||
},
|
||||
|
|
@ -689,7 +688,7 @@ export default class AgentClientPlugin extends Plugin {
|
|||
name: "Toggle auto-mention",
|
||||
callback: () => {
|
||||
this.app.workspace.trigger(
|
||||
"agent-client:toggle-auto-mention" as "quit",
|
||||
"agent-client:toggle-auto-mention",
|
||||
this.lastActiveChatViewId,
|
||||
);
|
||||
},
|
||||
|
|
@ -700,7 +699,7 @@ export default class AgentClientPlugin extends Plugin {
|
|||
name: "New chat",
|
||||
callback: () => {
|
||||
this.app.workspace.trigger(
|
||||
"agent-client:new-chat-requested" as "quit",
|
||||
"agent-client:new-chat-requested",
|
||||
this.lastActiveChatViewId,
|
||||
);
|
||||
},
|
||||
|
|
@ -711,7 +710,7 @@ export default class AgentClientPlugin extends Plugin {
|
|||
name: "Cancel current message",
|
||||
callback: () => {
|
||||
this.app.workspace.trigger(
|
||||
"agent-client:cancel-message" as "quit",
|
||||
"agent-client:cancel-message",
|
||||
this.lastActiveChatViewId,
|
||||
);
|
||||
},
|
||||
|
|
@ -722,7 +721,7 @@ export default class AgentClientPlugin extends Plugin {
|
|||
name: "Export chat",
|
||||
callback: () => {
|
||||
this.app.workspace.trigger(
|
||||
"agent-client:export-chat" as "quit",
|
||||
"agent-client:export-chat",
|
||||
this.lastActiveChatViewId,
|
||||
);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ export function ChatPanel({
|
|||
) => {
|
||||
target.addEventListener(type, callback);
|
||||
registeredListenersRef.current.push({ target, type, callback });
|
||||
}) as IChatViewHost["registerDomEvent"],
|
||||
}),
|
||||
};
|
||||
}, [viewHostProp, plugin.app]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue