Skip to content

Commit

Permalink
get rid of linter warnings - part I
Browse files Browse the repository at this point in the history
Signed-off-by: julianbollig <[email protected]>
  • Loading branch information
julianbollig committed Jan 30, 2025
1 parent d7f4d98 commit f542de6
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 27 deletions.
23 changes: 11 additions & 12 deletions WebUI/electron/subprocesses/aiBackendService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ export class AiBackendService extends LongLivedPythonApiService {
async *set_up(): AsyncIterable<SetupProgress> {
this.setStatus('installing')
this.appLogger.info('setting up service', this.name)
const self = this

try {
yield {
serviceName: self.name,
serviceName: this.name,
step: 'start',
status: 'executing',
debugMessage: 'starting to set up environment',
Expand All @@ -35,49 +34,49 @@ export class AiBackendService extends LongLivedPythonApiService {

const deviceArch: string = 'mac'
yield {
serviceName: self.name,
serviceName: this.name,
step: `Detecting intel device`,
status: 'executing',
debugMessage: `detected intel hardware ${deviceArch}`,
}

yield {
serviceName: self.name,
serviceName: this.name,
step: `install dependencies`,
status: 'executing',
debugMessage: `installing dependencies`,
}
const deviceSpecificRequirements = existingFileOrError(
path.join(self.serviceDir, `requirements-${deviceArch}.txt`),
path.join(this.serviceDir, `requirements-${deviceArch}.txt`),
)
await this.pip.run(['install', '-r', deviceSpecificRequirements])
if (deviceArch === 'bmg') {
const intelSpecificExtension = existingFileOrError(self.customIntelExtensionForPytorch)
const intelSpecificExtension = existingFileOrError(this.customIntelExtensionForPytorch)
await this.pip.run(['install', intelSpecificExtension])
}

const commonRequirements = existingFileOrError(path.join(self.serviceDir, 'requirements.txt'))
const commonRequirements = existingFileOrError(path.join(this.serviceDir, 'requirements.txt'))
await this.uvPip.run(['install', '-r', commonRequirements])
yield {
serviceName: self.name,
serviceName: this.name,
step: `install dependencies`,
status: 'executing',
debugMessage: `dependencies installed`,
}

this.setStatus('notYetStarted')
yield {
serviceName: self.name,
serviceName: this.name,
step: 'end',
status: 'success',
debugMessage: `service set up completely`,
}
} catch (e) {
self.appLogger.warn(`Set up of service failed due to ${e}`, self.name, true)
self.appLogger.warn(`Aborting set up of ${self.name} service environment`, self.name, true)
this.appLogger.warn(`Set up of service failed due to ${e}`, this.name, true)
this.appLogger.warn(`Aborting set up of ${this.name} service environment`, this.name, true)
this.setStatus('installationFailed')
yield {
serviceName: self.name,
serviceName: this.name,
step: 'end',
status: 'failed',
debugMessage: `Failed to setup python environment due to ${e}`,
Expand Down
19 changes: 9 additions & 10 deletions WebUI/electron/subprocesses/llamaCppBackendService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ export class LlamaCppBackendService extends LongLivedPythonApiService {
async *set_up(): AsyncIterable<SetupProgress> {
this.setStatus('installing')
this.appLogger.info('setting up service', this.name)
const self = this

try {
yield {
serviceName: self.name,
serviceName: this.name,
step: 'start',
status: 'executing',
debugMessage: 'starting to set up python environment',
Expand All @@ -41,19 +40,19 @@ export class LlamaCppBackendService extends LongLivedPythonApiService {

const deviceArch: string = 'mac'
yield {
serviceName: self.name,
serviceName: this.name,
step: `Detecting intel device`,
status: 'executing',
debugMessage: `detected intel hardware ${deviceArch}`,
}

yield {
serviceName: self.name,
serviceName: this.name,
step: `install dependencies`,
status: 'executing',
debugMessage: `installing dependencies`,
}
const commonRequirements = existingFileOrError(path.join(self.serviceDir, 'requirements.txt'))
const commonRequirements = existingFileOrError(path.join(this.serviceDir, 'requirements.txt'))
const intelSpecificExtensionDir = app.isPackaged
? this.baseDir
: path.join(__dirname, '../../external')
Expand All @@ -63,25 +62,25 @@ export class LlamaCppBackendService extends LongLivedPythonApiService {
await this.uvPip.pip.run(['install', intelSpecificExtension])
await this.uvPip.run(['install', '-r', commonRequirements])
yield {
serviceName: self.name,
serviceName: this.name,
step: `install dependencies`,
status: 'executing',
debugMessage: `dependencies installed`,
}

this.setStatus('notYetStarted')
yield {
serviceName: self.name,
serviceName: this.name,
step: 'end',
status: 'success',
debugMessage: `service set up completely`,
}
} catch (e) {
self.appLogger.warn(`Set up of service failed due to ${e}`, self.name, true)
self.appLogger.warn(`Aborting set up of ${self.name} service environment`, self.name, true)
this.appLogger.warn(`Set up of service failed due to ${e}`, this.name, true)
this.appLogger.warn(`Aborting set up of ${this.name} service environment`, this.name, true)
this.setStatus('installationFailed')
yield {
serviceName: self.name,
serviceName: this.name,
step: 'end',
status: 'failed',
debugMessage: `Failed to setup python environment due to ${e}`,
Expand Down
2 changes: 1 addition & 1 deletion WebUI/src/components/DropSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class="v-drop-select-list absolute left-0 top-0"
:style="{ translate: translate, width: `${listRect.width}px` }"
>
<li v-for="(item, i) in array" @click="changeSelectedItem(item, i)">
<li v-for="(item, i) in array" @click="changeSelectedItem(item, i)" :key="i">
<slot name="list" v-bind="{ item: item, index: i }">{{ item }}</slot>
</li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions WebUI/src/components/PaintInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<li
v-for="(v, k) in props.params"
class="last:border-none border-b border-color-spilter flex items-start"
:key="k"
>
<span class="text-base font-bold px-4 items-stretch w-36 flex-none">{{ k }}</span>
<span class="px-4 flex-auto break-word">{{ getModeText(k as string, v) }}</span>
Expand Down
6 changes: 5 additions & 1 deletion WebUI/src/components/Rag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
@drop="dropFileToUpload"
@dragover="dragOverHandler"
>
<div v-for="item in fileList" class="flex items-center gap-2 justify-center w-full h-8">
<div
v-for="(item, i) in fileList"
class="flex items-center gap-2 justify-center w-full h-8"
:key="i"
>
<span class="svg-icon flex-none w-5 h-5" :class="getIconClass(item.type)"></span>
<div class="flex-grow line2 overflow-hidden text-ellipsis h-6" :title="item.filename">
{{ item.filename }}
Expand Down
2 changes: 1 addition & 1 deletion WebUI/src/components/ui/slider/ResolutionPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const sliderModel = computed({
<SliderRange :className="clsx('absolute h-full', { 'bg-gradient': !disabled })" />
</SliderTrack>
<SliderThumb
v-if="!disabled"
v-show="!disabled"
v-for="(_, key) in sliderModel"
:key="key"
:className="
Expand Down
5 changes: 3 additions & 2 deletions WebUI/src/views/Answer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div
v-if="isHistoryVisible"
v-for="(conversation, conversationKey) in conversations.conversationList"
:key="conversationKey"
:key="'if' + conversationKey"
@click="onConversationClick(conversationKey)"
:title="conversation?.[0]?.title ?? languages.ANSWER_NEW_CONVERSATION"
class="flex justify-between items-center h-12 cursor-pointer text-gray-300 p-4 hover:bg-[#00c4fa]/50"
Expand All @@ -29,6 +29,7 @@
<div
v-else
v-for="(conversation, conversationKey) in conversations.conversationList"
:key="'else' + conversationKey"
:inVisibleKey="conversationKey"
@click="onConversationClick(conversationKey)"
:title="conversation?.[0]?.title ?? languages.ANSWER_NEW_CONVERSATION"
Expand Down Expand Up @@ -86,7 +87,7 @@
:class="fontSizeClass"
@scroll="handleScroll"
>
<template v-for="(chat, i) in conversations.activeConversation">
<template v-for="(chat, i) in conversations.activeConversation" :key="i">
<div class="flex items-start gap-3">
<img :class="iconSizeClass" src="@/assets/svg/user-icon.svg" />
<div class="flex flex-col gap-3 max-w-3/4">
Expand Down
2 changes: 2 additions & 0 deletions WebUI/src/views/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class="image-preview-item flex items-center justify-center"
:class="{ active: imageGeneration.previewIdx == i }"
@click="swithPreview(i)"
:key="i"
>
<div class="image-preview-item-bg">
<img :src="image" class="image-thumb" />
Expand All @@ -22,6 +23,7 @@
:src="image"
class="p-1 max-w-768px max-h-512px"
v-show="imageGeneration.previewIdx == i"
:key="i"
/>
<div
v-show="
Expand Down
2 changes: 2 additions & 0 deletions WebUI/src/views/Enhance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
class="image-preview-item flex items-center justify-center flex-none"
:class="{ active: previewIdx == i }"
@click="swithPreview((previewIdx = i))"
:key="i"
>
<div class="image-preview-item-bg">
<img :src="image" class="image-thumb" />
Expand Down Expand Up @@ -180,6 +181,7 @@
:src="image"
v-show="previewIdx == i"
class="p-1 max-w-768px max-h-400px"
:key="i"
/>
<div
v-show="processing && generateIdx == previewIdx"
Expand Down

0 comments on commit f542de6

Please sign in to comment.