fix: The proxy configuration is not correctly passed.
This commit is contained in:
parent
1d4916c516
commit
5bacf048f2
@ -13,6 +13,7 @@ import { getAllFiles } from '@main/utils/file'
|
||||
import type { LoaderReturn } from '@shared/config/types'
|
||||
import { FileType, KnowledgeBaseParams, KnowledgeItem } from '@types'
|
||||
import { app } from 'electron'
|
||||
import { ProxyAgent, setGlobalDispatcher } from 'undici'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
import { proxyManager } from './ProxyManager'
|
||||
@ -85,6 +86,7 @@ class KnowledgeService {
|
||||
_: Electron.IpcMainInvokeEvent,
|
||||
{ base, item, forceReload = false }: { base: KnowledgeBaseParams; item: KnowledgeItem; forceReload: boolean }
|
||||
): Promise<LoaderReturn> => {
|
||||
setGlobalDispatcher(new ProxyAgent(proxyManager.getProxyUrl() || ''))
|
||||
const ragApplication = await this.getRagApplication(base)
|
||||
|
||||
const sendDirectoryProcessingPercent = (totalFiles: number, processedFiles: number) => {
|
||||
|
||||
@ -66,6 +66,7 @@ export class ProxyManager {
|
||||
private async setCustomProxy(): Promise<void> {
|
||||
try {
|
||||
if (this.config.url) {
|
||||
this.proxyUrl = this.config.url
|
||||
this.proxyAgent = new HttpsProxyAgent(this.config.url)
|
||||
this.setEnvironment(this.config.url)
|
||||
await this.setSessionsProxy({ proxyRules: this.config.url })
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user