Skip to content

Commit

Permalink
fix: rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
axel7083 committed Jan 12, 2024
1 parent 89613f1 commit 2a5da85
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/backend/src/studio-api-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Task } from '@shared/models/ITask';
import { Studio } from './studio';
import * as path from 'node:path';
import { ModelResponse } from '@shared/models/IModelResponse';
import { PlayGroundManager } from './playground';

export const RECENT_CATEGORY_ID = 'recent-category';

Expand All @@ -19,6 +20,7 @@ export class StudioApiImpl implements StudioAPI {
private applicationManager: ApplicationManager,
private recipeStatusRegistry: RecipeStatusRegistry,
private taskRegistry: TaskRegistry,
private playgroundManager: PlayGroundManager,
) {}

async openURL(url: string): Promise<void> {
Expand Down Expand Up @@ -93,16 +95,17 @@ export class StudioApiImpl implements StudioAPI {
if (localModelInfo.length !== 1) {
throw new Error('model not found');
}
const destDir = path.join();

const modelPath = path.resolve(this.applicationManager.homeDirectory, AI_STUDIO_FOLDER, 'models', modelId, localModelInfo[0].file);
this.studio.playgroundManager.startPlayground(modelId, modelPath);

await this.playgroundManager.startPlayground(modelId, modelPath);
}

askPlayground(modelId: string, prompt: string): Promise<ModelResponse> {
const localModelInfo = this.applicationManager.getLocalModels().filter(m => m.id === modelId);
if (localModelInfo.length !== 1) {
throw new Error('model not found');
}
return this.studio.playgroundManager.askPlayground(localModelInfo[0], prompt);
return this.playgroundManager.askPlayground(localModelInfo[0], prompt);
}
}
3 changes: 2 additions & 1 deletion packages/backend/src/studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ export class Studio {
this.studioApi = new StudioApiImpl(
applicationManager,
recipeStatusRegistry,
taskRegistry
taskRegistry,
this.playgroundManager,
);
// Register the instance
this.rpcExtension.registerInstance<StudioApiImpl>(StudioApiImpl, this.studioApi);
Expand Down
1 change: 1 addition & 0 deletions packages/shared/StudioAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { Category } from '@shared/models/ICategory';
import { RecipeStatus } from '@shared/models/IRecipeStatus';
import { ModelInfo } from '@shared/models/IModelInfo';
import { ModelResponse } from '@shared/models/IModelResponse';
import { Task } from './models/ITask';

export abstract class StudioAPI {
abstract ping(): Promise<string>;
Expand Down

0 comments on commit 2a5da85

Please sign in to comment.