Skip to content

Commit 8d8e876

Browse files
committed
Remove support for user-provided ports for Open WebUI configurations
- to mitigate this:[Pasted text] should remove 'open web ui' from running in localhost (only [Fragment]) ├── apps │ ├── browser │ │ └── src │ │ ├── content-scripts │ │ │ └── send-prompt-content-script │ │ │ ├── chatbots │ │ │ │ ├── index.ts │ │ │ │ └── open-webui.ts │ │ │ └── send-prompt-content-script.ts │ │ └── manifest.json │ └── editor │ └── src │ ├── services │ │ └── websocket-manager.ts │ └── views │ ├── prompt │ │ └── frontend │ │ └── Main │ │ └── MainView │ │ └── MainView.tsx │ ├── settings │ │ └── frontend │ │ └── Home │ │ └── sections │ │ └── WebSection.tsx │ └── shared │ ├── actions │ │ └── web │ │ ├── create.ts │ │ └── pick-chatbot.ts │ ├── forms │ │ └── EditWebConfigurationForm │ │ └── EditWebConfigurationForm.tsx │ └── i18n │ └── translations │ └── edit-web-configuration-form.ts └── packages ├── shared │ └── src │ └── constants │ └── chatbots.ts └── ui └── src ├── assets │ └── icons │ └── open-webui.svg └── components └── editor └── common └── Icon └── Icon.tsx
1 parent aaf48e5 commit 8d8e876

8 files changed

Lines changed: 8 additions & 114 deletions

File tree

‎apps/browser/src/content-scripts/send-prompt-content-script/send-prompt-content-script.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ const is_z_ai =
9494
current_url.startsWith(z_ai_global_url) ||
9595
current_url.startsWith(z_ai_china_url)
9696

97-
const is_open_webui = document.title.includes('Open WebUI')
97+
const open_webui_url = 'http://openwebui/'
98+
const is_open_webui = current_url.startsWith(open_webui_url)
9899

99100
let chatbot: Chatbot | null = null
100101

‎apps/browser/src/manifest.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@
4545
"https://chat.together.ai/",
4646
"https://yuanbao.tencent.com/*",
4747
"https://chat.z.ai/",
48-
"https://zchat.z.ai/",
49-
"http://localhost/"
48+
"https://zchat.z.ai/"
5049
],
5150
"js": ["send-prompt-content-script.js"]
5251
}

‎apps/editor/src/services/websocket-manager.ts‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,7 @@ export class WebSocketManager {
454454
url = base_url
455455
}
456456
} else if (web_configuration.chatbot === 'Open WebUI') {
457-
if (web_configuration.port) {
458-
url = `http://localhost:${web_configuration.port}/`
459-
} else {
460-
url = 'http://openwebui/'
461-
}
457+
url = 'http://openwebui/'
462458
} else if (web_configuration.chatbot === 'Arena') {
463459
if (web_configuration.model) {
464460
url = `https://arena.ai/?mode=direct&model=${web_configuration.model}`
@@ -559,11 +555,7 @@ export class WebSocketManager {
559555
url = base_url
560556
}
561557
} else if (params.web_configuration.chatbot === 'Open WebUI') {
562-
if (params.web_configuration.port) {
563-
url = `http://localhost:${params.web_configuration.port}/`
564-
} else {
565-
url = 'http://openwebui/'
566-
}
558+
url = 'http://openwebui/'
567559
} else if (params.web_configuration.chatbot === 'Arena') {
568560
if (params.web_configuration.model) {
569561
url = `https://arena.ai/?mode=direct&model=${params.web_configuration.model}`

‎apps/editor/src/views/shared/actions/web/create.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@ export const create = async (params: {
7070
const items: vscode.QuickPickItem[] = chatbots.map(
7171
([chatbot, { url }]) => ({
7272
label: chatbot,
73-
description:
74-
chatbot === 'Open WebUI'
75-
? 'localhost'
76-
: url.replace(/^https?:\/\//, '').split('/')[0]
73+
description: url.replace(/^https?:\/\//, '').split('/')[0]
7774
})
7875
)
7976

‎apps/editor/src/views/shared/actions/web/pick-chatbot.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ export const pick_chatbot = async (params: {
99

1010
const items: vscode.QuickPickItem[] = chatbots.map(([chatbot, { url }]) => ({
1111
label: chatbot,
12-
description:
13-
chatbot === 'Open WebUI'
14-
? 'localhost'
15-
: url.replace(/^https?:\/\//, '').split('/')[0]
12+
description: url.replace(/^https?:\/\//, '').split('/')[0]
1613
}))
1714

1815
const quick_pick = vscode.window.createQuickPick()

‎apps/editor/src/views/shared/forms/EditWebConfigurationForm/EditWebConfigurationForm.tsx‎

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Scrollable as UiScrollable } from '@ui/components/editor/common/Scrolla
1111
import { Fieldset as UiFieldset } from '@ui/components/editor/prompt-view/Fieldset'
1212
import { QuickPickButton as UiQuickPickButton } from '@ui/components/editor/common/QuickPickButton'
1313
import { TextButton as UiTextButton } from '@ui/components/editor/common/TextButton'
14-
import { use_translation, Translation } from '../../i18n/use-translation'
14+
import { use_translation } from '../../i18n/use-translation'
1515

1616
type Props = {
1717
web_configuration: WebConfiguration
@@ -35,7 +35,6 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
3535
const [system_instructions, set_system_instructions] = useState(
3636
props.web_configuration.system_instructions
3737
)
38-
const [port, set_port] = useState(props.web_configuration.port)
3938
const [new_url, set_new_url] = useState(props.web_configuration.new_url)
4039
const [options, set_options] = useState<string[]>(
4140
props.web_configuration.options || []
@@ -73,7 +72,6 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
7372
!!model_info?.supported_reasoning_efforts
7473
const supports_system_instructions =
7574
chatbot_config.supports_system_instructions
76-
const supports_port = chatbot_config.supports_user_provided_port
7775
const supports_url_override = chatbot_config.supports_url_override
7876
const supports_user_provided_model =
7977
chatbot_config.supports_user_provided_model
@@ -85,7 +83,6 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
8583
...(reasoning_effort ? { reasoning_effort } : {}),
8684
...(model ? { model } : {}),
8785
...(system_instructions ? { system_instructions } : {}),
88-
...(port !== undefined ? { port } : {}),
8986
...(new_url ? { new_url } : {}),
9087
...(options.length ? { options } : {}),
9188
is_pinned: props.web_configuration.is_pinned
@@ -96,15 +93,13 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
9693
chatbot,
9794
model,
9895
system_instructions,
99-
port,
10096
new_url,
10197
options
10298
])
10399

104100
const handle_chatbot_change = (new_chatbot: keyof typeof CHATBOTS) => {
105101
set_chatbot(new_chatbot)
106102
set_model(undefined)
107-
set_port(undefined)
108103
set_new_url(undefined)
109104
set_reasoning_effort(undefined)
110105
if (CHATBOTS[new_chatbot].supports_system_instructions) {
@@ -270,34 +265,6 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
270265
/>
271266
</UiField>
272267

273-
{supports_port && (
274-
<UiField
275-
label={t('edit-web-configuration-form.port')}
276-
html_for="port"
277-
info={
278-
chatbot === 'Open WebUI' && (
279-
<Translation id="edit-web-configuration-form.port.info" />
280-
)
281-
}
282-
>
283-
<UiInput
284-
id="port"
285-
type="text"
286-
value={String(port ?? '')}
287-
on_change={(value) => {
288-
const num = parseInt(value, 10)
289-
set_port(isNaN(num) ? undefined : num)
290-
}}
291-
placeholder={t('edit-web-configuration-form.port.placeholder')}
292-
on_key_down={(e) =>
293-
!/[0-9]/.test(e.key) &&
294-
e.key !== 'Backspace' &&
295-
e.preventDefault()
296-
}
297-
/>
298-
</UiField>
299-
)}
300-
301268
{supports_url_override && (
302269
<UiField
303270
label={

‎apps/editor/src/views/shared/i18n/translations/edit-web-configuration-form.ts‎

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -125,63 +125,6 @@ export const translations = {
125125
hu: 'Csoport',
126126
bg: 'Група'
127127
},
128-
'edit-web-configuration-form.port': {
129-
en: 'Port',
130-
pl: 'Port',
131-
'zh-cn': '端口',
132-
ja: 'ポート',
133-
'zh-tw': '通訊埠',
134-
de: 'Port',
135-
es: 'Puerto',
136-
fr: 'Port',
137-
'pt-br': 'Porta',
138-
ru: 'Порт',
139-
ko: '포트',
140-
it: 'Porta',
141-
tr: 'Bağlantı Noktası',
142-
cs: 'Port',
143-
hu: 'Port',
144-
bg: 'Порт'
145-
},
146-
'edit-web-configuration-form.port.info': {
147-
en: 'Used for localhost. For networked instances leave empty and setup a proxy server for <code>http://openwebui/</code>.',
148-
pl: 'Używane dla localhost. Dla instancji sieciowych pozostaw puste i skonfiguruj serwer proxy dla <code>http://openwebui/</code>.',
149-
'zh-cn':
150-
'用于 localhost。对于网络实例,请留空并为 <code>http://openwebui/</code> 设置代理服务器。',
151-
ja: 'localhost に使用されます。ネットワーク化されたインスタンスの場合は空白のままにし、<code>http://openwebui/</code> 用のプロキシサーバーを設定します。',
152-
'zh-tw':
153-
'用於 localhost。對於網路實例,請留空並為 <code>http://openwebui/</code> 設定代理伺服器。',
154-
de: 'Wird für Localhost verwendet. Lassen Sie dies bei vernetzten Instanzen leer und richten Sie einen Proxy-Server für <code>http://openwebui/</code> ein.',
155-
es: 'Se usa para localhost. Para instancias en red, déjalo vacío y configura un servidor proxy para <code>http://openwebui/</code>.',
156-
fr: 'Utilisé pour localhost. Pour les instances en réseau, laissez vide et configure un serveur proxy pour <code>http://openwebui/</code>.',
157-
'pt-br':
158-
'Usado para localhost. Para instâncias de rede, deixe vazio e configure um servidor proxy para <code>http://openwebui/</code>.',
159-
ru: 'Используется для localhost. Для сетевых экземпляров оставьте пустым и настройте прокси-сервер для <code>http://openwebui/</code>.',
160-
ko: 'localhost에 사용됩니다. 네트워크 인스턴스의 경우 비워 두고 <code>http://openwebui/</code>에 대한 프록시 서버를 설정합니다.',
161-
it: 'Usado per localhost. Per le istanze di rete lascia vuoto e configura un server proxy per <code>http://openwebui/</code>.',
162-
tr: 'Localhost için kullanılır. Ağa bağlı örnekler için boş bırakın ve <code>http://openwebui/</code> için bir proxy sunucusu kurun.',
163-
cs: 'Používá se pro localhost. Pro síťové instance ponechte prázdné a nastavte proxy server pro <code>http://openwebui/</code>.',
164-
hu: 'Localhosthoz használatos. Hálózati példányok esetén hagyja üresen, és állítson be proxyszervert a <code>http://openwebui/</code> számára.',
165-
bg: 'Използва се за localhost. За мрежови инстанции оставете празно и настройте прокси сървър за <code>http://openwebui/</code>.'
166-
},
167-
'edit-web-configuration-form.port.placeholder': {
168-
en: 'e.g. 3000',
169-
pl: 'np. 3000',
170-
'zh-cn': '例如 3000',
171-
ja: '例:3000',
172-
'zh-tw': '例如 3000',
173-
de: 'z.B. 3000',
174-
es: 'ej. 3000',
175-
fr: 'ex. 3000',
176-
'pt-br': 'ex. 3000',
177-
ru: 'напр. 3000',
178-
ko: '예: 3000',
179-
it: 'es. 3000',
180-
tr: 'örn. 3000',
181-
cs: 'např. 3000',
182-
hu: 'pl. 3000',
183-
bg: 'напр. 3000'
184-
},
185128
'edit-web-configuration-form.url-override': {
186129
en: 'URL override',
187130
pl: 'Nadpisanie URL',

‎packages/shared/src/constants/chatbots.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ type Chatbot = {
22
url: string
33
supports_system_instructions?: boolean
44
supports_user_provided_model?: boolean
5-
supports_user_provided_port?: boolean
65
supports_reasoning_effort?: boolean
76
supported_reasoning_efforts?: string[]
87
supports_url_override?: boolean
@@ -150,7 +149,6 @@ export const CHATBOTS = {
150149
url: 'http://openwebui/',
151150
supports_system_instructions: true,
152151
supports_user_provided_model: true,
153-
supports_user_provided_port: true,
154152
default_system_instructions: "You're a helpful coding assistant."
155153
} as Chatbot,
156154
OpenRouter: {

0 commit comments

Comments
 (0)