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 type { LoaderReturn } from '@shared/config/types'
|
||||||
import { FileType, KnowledgeBaseParams, KnowledgeItem } from '@types'
|
import { FileType, KnowledgeBaseParams, KnowledgeItem } from '@types'
|
||||||
import { app } from 'electron'
|
import { app } from 'electron'
|
||||||
|
import { ProxyAgent, setGlobalDispatcher } from 'undici'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
|
||||||
import { proxyManager } from './ProxyManager'
|
import { proxyManager } from './ProxyManager'
|
||||||
@ -85,6 +86,7 @@ class KnowledgeService {
|
|||||||
_: Electron.IpcMainInvokeEvent,
|
_: Electron.IpcMainInvokeEvent,
|
||||||
{ base, item, forceReload = false }: { base: KnowledgeBaseParams; item: KnowledgeItem; forceReload: boolean }
|
{ base, item, forceReload = false }: { base: KnowledgeBaseParams; item: KnowledgeItem; forceReload: boolean }
|
||||||
): Promise<LoaderReturn> => {
|
): Promise<LoaderReturn> => {
|
||||||
|
setGlobalDispatcher(new ProxyAgent(proxyManager.getProxyUrl() || ''))
|
||||||
const ragApplication = await this.getRagApplication(base)
|
const ragApplication = await this.getRagApplication(base)
|
||||||
|
|
||||||
const sendDirectoryProcessingPercent = (totalFiles: number, processedFiles: number) => {
|
const sendDirectoryProcessingPercent = (totalFiles: number, processedFiles: number) => {
|
||||||
|
|||||||
@ -66,6 +66,7 @@ export class ProxyManager {
|
|||||||
private async setCustomProxy(): Promise<void> {
|
private async setCustomProxy(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
if (this.config.url) {
|
if (this.config.url) {
|
||||||
|
this.proxyUrl = this.config.url
|
||||||
this.proxyAgent = new HttpsProxyAgent(this.config.url)
|
this.proxyAgent = new HttpsProxyAgent(this.config.url)
|
||||||
this.setEnvironment(this.config.url)
|
this.setEnvironment(this.config.url)
|
||||||
await this.setSessionsProxy({ proxyRules: this.config.url })
|
await this.setSessionsProxy({ proxyRules: this.config.url })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user