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

Fix bug #2005 docker blank website #2093

Merged
merged 6 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix error settings/settings.json not found when start server at the f…
…irst time
  • Loading branch information
hientominh authored and hiento09 committed Feb 19, 2024
commit 9ce626d8d58431d45dc6e60fe5d7b94acdd0dcb7
5 changes: 4 additions & 1 deletion extensions/inference-nitro-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ export default class JanInferenceNitroExtension extends InferenceExtension {
// init inference url
// @ts-ignore
const electronApi = window?.electronAPI
this.inferenceUrl = electronApi ? INFERENCE_URL : `${window.core?.api?.baseApiUrl}/v1/chat/completions` ?? 'http:https://localhost:1337/v1/chat/completions'
this.inferenceUrl = INFERENCE_URL
if (!electronApi) {
this.inferenceUrl = `${window.core?.api?.baseApiUrl}/v1/chat/completions`
}
console.debug('Inference url: ', this.inferenceUrl)

if (!(await fs.existsSync(JanInferenceNitroExtension._settingsDir)))
Expand Down
26 changes: 26 additions & 0 deletions server/helpers/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,32 @@ export async function setup() {
'utf-8'
)

if (!existsSync(join(appDir, 'settings'))) {
console.debug('Writing nvidia config file...')
mkdirSync(join(appDir, 'settings'))
writeFileSync(
join(appDir, 'settings', 'settings.json'),
JSON.stringify(
{
notify: true,
run_mode: 'cpu',
nvidia_driver: {
exist: false,
version: '',
},
cuda: {
exist: false,
version: '',
},
gpus: [],
gpu_highest_vram: '',
gpus_in_use: [],
is_initial: true,
}),
'utf-8'
)
}

/**
* Install extensions
*/
Expand Down