Skip to content

Commit

Permalink
And forgot to do the type check, and a cosmetic fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Arne Durr committed Dec 22, 2024
1 parent e028c01 commit f7baff8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
21 changes: 9 additions & 12 deletions app/components/settings/providers/ProvidersTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export default function ProvidersTab() {
newFilteredProviders.sort((a, b) => a.name.localeCompare(b.name));

// Split providers into regular and URL-configurable
const regular = newFilteredProviders.filter(p => !URL_CONFIGURABLE_PROVIDERS.includes(p.name));
const urlConfigurable = newFilteredProviders.filter(p => URL_CONFIGURABLE_PROVIDERS.includes(p.name));
const regular = newFilteredProviders.filter((p) => !URL_CONFIGURABLE_PROVIDERS.includes(p.name));
const urlConfigurable = newFilteredProviders.filter((p) => URL_CONFIGURABLE_PROVIDERS.includes(p.name));

setFilteredProviders([...regular, ...urlConfigurable]);
}, [providers, searchTerm, isLocalModel]);
Expand Down Expand Up @@ -112,8 +112,8 @@ export default function ProvidersTab() {
);
};

const regularProviders = filteredProviders.filter(p => !URL_CONFIGURABLE_PROVIDERS.includes(p.name));
const urlConfigurableProviders = filteredProviders.filter(p => URL_CONFIGURABLE_PROVIDERS.includes(p.name));
const regularProviders = filteredProviders.filter((p) => !URL_CONFIGURABLE_PROVIDERS.includes(p.name));
const urlConfigurableProviders = filteredProviders.filter((p) => URL_CONFIGURABLE_PROVIDERS.includes(p.name));

return (
<div className="p-4">
Expand All @@ -128,22 +128,19 @@ export default function ProvidersTab() {
</div>

{/* Regular Providers Grid */}
<div className="grid grid-cols-2 gap-4 mb-8">
{regularProviders.map(renderProviderCard)}
</div>
<div className="grid grid-cols-2 gap-4 mb-8">{regularProviders.map(renderProviderCard)}</div>

{/* URL Configurable Providers Section */}
{urlConfigurableProviders.length > 0 && (
<div className="mt-8">
<h3 className="text-lg font-semibold mb-2 text-bolt-elements-textPrimary">Experimental Providers</h3>
<p className="text-sm text-bolt-elements-textSecondary mb-4">
These providers are experimental and allow you to run AI models locally or connect to your own infrastructure. They require additional setup but offer more flexibility.
These providers are experimental and allow you to run AI models locally or connect to your own
infrastructure. They require additional setup but offer more flexibility.
</p>
<div className="space-y-4">
{urlConfigurableProviders.map(renderProviderCard)}
</div>
<div className="space-y-4">{urlConfigurableProviders.map(renderProviderCard)}</div>
</div>
)}
</div>
);
}
}
10 changes: 10 additions & 0 deletions app/lib/git/components/ProviderCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ export function ProviderCard({
<li key={index}>{step}</li>
))}
</ul>
<p>
<a
href={provider.tokenSetupSetupUrl}
target="_blank"
rel="noreferrer"
className="text-sm text-blue-500 hover:underline"
>
{provider.tokenSetupSetupUrl}
</a>
</p>
</div>

<div className="flex mb-4">
Expand Down
8 changes: 4 additions & 4 deletions app/lib/git/providers/github/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const githubProvider: GitProvider = {
icon: 'i-mdi:github-icon',
};

let project: Endpoints['GET /repos/{owner}/{repo}']['response']['data'] | null = null;
let project: Endpoints['GET /repos/{owner}/{repo}']['response']['data'] | any = null;
let octokit: Octokit;

export const githubAPI: GitProviderAPI = {
Expand Down Expand Up @@ -201,7 +201,7 @@ export const githubAPI: GitProviderAPI = {

return {
success: true,
message: `Repository created and code pushed: ${project?.html_url}`,
message: `Repository created and code pushed: ${project.html_url}`,
};
}

Expand All @@ -212,7 +212,7 @@ export const githubAPI: GitProviderAPI = {
await this.createCommit(files, commitMsg);
return {
success: true,
message: `Successfully commit to: ${project?.html_url}`,
message: `Successfully commit to: ${project.html_url}`,
};
} catch (error: any) {
if (error.message.includes('Update is not a fast-forward')) {
Expand Down Expand Up @@ -247,7 +247,7 @@ export const githubAPI: GitProviderAPI = {

return {
success: true,
message: `Successfully commit to: ${project?.html_url}`,
message: `Successfully commit to: ${project.html_url}`,
};
} catch (error: any) {
console.error('Error pushing to GitHub:', error);
Expand Down

0 comments on commit f7baff8

Please sign in to comment.