Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move getLocalModels to ModelsManager #112

Merged
merged 2 commits into from
Jan 23, 2024
Merged

Conversation

feloy
Copy link
Contributor

@feloy feloy commented Jan 23, 2024

No description provided.

@feloy feloy force-pushed the refacto/getLocalModels branch 3 times, most recently from 0347457 to 0ef4670 Compare January 23, 2024 09:46
@feloy feloy changed the title [wip] refactor: move getLocalModels to ModelsManager refactor: move getLocalModels to ModelsManager Jan 23, 2024
@feloy feloy requested review from axel7083, lstocchi and benoitf and removed request for axel7083 January 23, 2024 10:07
import type { GitManager } from './gitManager';
import os from 'os';
import fs, { Stats, type Dirent } from 'fs';
import path from 'path';
import fs from 'fs';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import fs from 'fs';
import fs from 'node:fs';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using node: prefix is recommended for all the 'internal' packages

it's to avoid for example that you use https://www.npmjs.com/package/fs

export class ModelsManager {
constructor(private appUserDirectory: string) {}

getLocalModels(): LocalModelInfo[] {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a question.
It seems it's a lazy initialization and without cache, do we need to read the files each time we're called or you're planning to read it eagerly or have a cache

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could watch the folder for changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I created #116

@feloy feloy force-pushed the refacto/getLocalModels branch from 0ef4670 to 1c6a778 Compare January 23, 2024 10:34
@feloy feloy merged commit 8b63ac9 into main Jan 23, 2024
3 checks passed
@feloy feloy deleted the refacto/getLocalModels branch January 23, 2024 10:49
mhdawson pushed a commit to mhdawson/podman-desktop-extension-ai-lab that referenced this pull request Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants