Skip to content

Commit

Permalink
fix: The proxy configuration is not correctly passed.
Browse files Browse the repository at this point in the history
  • Loading branch information
DeJeune authored and kangfenmao committed Feb 28, 2025
1 parent 1d4916c commit 5bacf04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/services/KnowledgeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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) => {
Expand Down
1 change: 1 addition & 0 deletions src/main/services/ProxyManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down

0 comments on commit 5bacf04

Please sign in to comment.