-
Notifications
You must be signed in to change notification settings - Fork 381
Hostname for calling service #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c9e6565
3c2b064
4b6b6e0
b606de0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,6 @@ import type { Inputs, Outputs } from '../GraphProcessor.js'; | |
| import { cleanHeaders, getInputOrData } from '../../utils/inputs.js'; | ||
| import type { InternalProcessContext } from '../ProcessContext.js'; | ||
| import { chatMessageToOpenAIChatCompletionMessage } from '../../utils/chatMessageToOpenAIChatCompletionMessage.js'; | ||
| import { DEFAULT_CHAT_ENDPOINT } from '../../utils/defaults.js'; | ||
| import type { TokenizerCallInfo } from '../../integrations/Tokenizer.js'; | ||
| import { addWarning } from '../../utils/outputs.js'; | ||
| import retry from 'p-retry'; | ||
|
|
@@ -1008,7 +1007,8 @@ export const ChatNodeBase = { | |
| const isMultiResponse = data.useNumberOfChoicesInput || (data.numberOfChoices ?? 1) > 1; | ||
|
|
||
| // Resolve to final endpoint if configured in ProcessContext | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P1] Keep |
||
| const configuredEndpoint = endpoint || context.settings.openAiEndpoint || DEFAULT_CHAT_ENDPOINT; | ||
| const baseUrl = context.settings.openAiEndpoint ?? 'https://api.openai.com/v1'; | ||
| const configuredEndpoint = endpoint || `${baseUrl}/chat/completions`; | ||
| const resolvedEndpointAndHeaders = context.getChatNodeEndpoint | ||
| ? await context.getChatNodeEndpoint(configuredEndpoint, finalModel) | ||
| : { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,7 +106,8 @@ export const GetAssistantNodeImpl: PluginNodeImpl<GetAssistantNode> = { | |
| throw new Error('OpenAI key is not set.'); | ||
| } | ||
|
|
||
| const response = await fetch(`https://api.openai.com/v1/assistants/${assistantId}`, { | ||
| const baseUrl = context.settings.openAiEndpoint ?? 'https://api.openai.com/v1'; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Do not reuse the chat endpoint as the assistants/files base URL. This is only safe when |
||
| const response = await fetch(`${baseUrl}/assistants/${assistantId}`, { | ||
| method: 'GET', | ||
| headers: { | ||
| 'OpenAI-Beta': 'assistants=v1', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1 @@ | ||
| export const DEFAULT_CHAT_ENDPOINT = 'https://api.openai.com/v1/chat/completions'; | ||
|
|
||
| export const DEFAULT_CHAT_NODE_TIMEOUT = 30_000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P0] Restore the default OpenAI URL when
openAiEndpointis blank.openAiEndpointis normalized to''by the processor/app settings, so??never falls back here. With the default configuration (no custom endpoint set), this now builds/chat/completionsinstead ofhttps://api.openai.com/v1/chat/completions, and the same pattern in the new assistant/file/thread calls yields relative URLs as well. That breaks ordinary OpenAI usage for anyone who leaves the endpoint empty.