mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-18 20:03:33 +00:00
Simplify ArtifactsRuntimeProvider constructor
- Take artifactsPanel and agent directly instead of 5 separate function parameters - Define minimal ArtifactsPanelLike and AgentLike interfaces to avoid circular deps - Update all call sites (ChatPanel, browser-javascript) to use simplified constructor - Much cleaner and easier to use
This commit is contained in:
parent
c0ad46fa01
commit
695bcf9b6f
2 changed files with 35 additions and 45 deletions
|
|
@ -112,34 +112,7 @@ export class ChatPanel extends LitElement {
|
|||
}
|
||||
|
||||
// Add artifacts provider (always available)
|
||||
providers.push(
|
||||
new ArtifactsRuntimeProvider(
|
||||
() => this.artifactsPanel!.artifacts,
|
||||
async (filename: string, content: string) => {
|
||||
await this.artifactsPanel!.tool.execute("", {
|
||||
command: "create",
|
||||
filename,
|
||||
content,
|
||||
});
|
||||
},
|
||||
async (filename: string, content: string) => {
|
||||
await this.artifactsPanel!.tool.execute("", {
|
||||
command: "rewrite",
|
||||
filename,
|
||||
content,
|
||||
});
|
||||
},
|
||||
async (filename: string) => {
|
||||
await this.artifactsPanel!.tool.execute("", {
|
||||
command: "delete",
|
||||
filename,
|
||||
});
|
||||
},
|
||||
(message: any) => {
|
||||
this.agent!.appendMessage(message);
|
||||
},
|
||||
),
|
||||
);
|
||||
providers.push(new ArtifactsRuntimeProvider(this.artifactsPanel!, this.agent!));
|
||||
|
||||
return providers;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue