Skip to content
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

fix: hide placeholder python engine and unsupported openai o1 system … #4455

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"transform_req": {
"chat_completions": {
"url": "https://api.openai.com/v1/chat/completions",
"template": "{ {% set first = true %}{% for key, value in input_request %}{% if key == \"model\" or key == \"temperature\" or key == \"store\" or key == \"messages\" or key == \"stream\" or key == \"presence_penalty\" or key == \"metadata\" or key == \"frequency_penalty\" or key == \"tools\" or key == \"tool_choice\" or key == \"logprobs\" or key == \"top_logprobs\" or key == \"logit_bias\" or key == \"n\" or key == \"modalities\" or key == \"prediction\" or key == \"response_format\" or key == \"service_tier\" or key == \"seed\" or key == \"stream_options\" or key == \"top_p\" or key == \"parallel_tool_calls\" or key == \"user\" or (not \"o1\" in input_request.model and (key == \"max_tokens\" or key == \"stop\")) %} {% if key == \"max_tokens\" and \"o1\" in input_request.model %} \"max_completion_tokens\": {{ tojson(value) }} {% else %} {% if not first %},{% endif %} \"{{ key }}\": {{ tojson(value) }} {% set first = false %} {% endif %} {% endif %} {% endfor %} }"
"template": "{ {% set first = true %} {% for key, value in input_request %} {% if key == \"model\" or key == \"temperature\" or key == \"store\" or key == \"messages\" or key == \"stream\" or key == \"presence_penalty\" or key == \"metadata\" or key == \"frequency_penalty\" or key == \"tools\" or key == \"tool_choice\" or key == \"logprobs\" or key == \"top_logprobs\" or key == \"logit_bias\" or key == \"n\" or key == \"modalities\" or key == \"prediction\" or key == \"response_format\" or key == \"service_tier\" or key == \"seed\" or key == \"stream_options\" or key == \"top_p\" or key == \"parallel_tool_calls\" or key == \"user\" or key == \"max_tokens\" or ((input_request.model == \"o1\" or input_request.model == \"o1-preview\" or input_request.model == \"o1-mini\") and (key == \"stop\")) %} {% if not first %} , {% endif %} {% if key == \"messages\" and (input_request.model == \"o1\" or input_request.model == \"o1-preview\" or input_request.model == \"o1-mini\") and input_request.messages.0.role == \"system\" %} \"messages\": [{% for message in input_request.messages %} {% if not loop.is_first %} { \"role\": \"{{ message.role }}\", \"content\": \"{{ message.content }}\" } {% if not loop.is_last %} , {% endif %} {% endif %} {% endfor %}] {% else if key == \"max_tokens\" and (input_request.model == \"o1\" or input_request.model == \"o1-preview\" or input_request.model == \"o1-mini\") %} \"max_completion_tokens\": {{ tojson(value) }} {% else %} \"{{ key }}\": {{ tojson(value) }} {% set first = false %} {% endif %} {% endif %} {% endfor %} }"
}
},
"transform_resp": {
Expand Down
12 changes: 10 additions & 2 deletions web/screens/Settings/Engines/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ const Engines = () => {
</h6>
{engines &&
Object.entries(engines).map(([key]) => {
if (!isLocalEngine(engines, key as InferenceEngine)) return
if (
!isLocalEngine(engines, key as InferenceEngine) ||
!engines[key as InferenceEngine].length
)
return
return (
<LocalEngineItems engine={key as InferenceEngine} key={key} />
)
Expand All @@ -40,7 +44,11 @@ const Engines = () => {
</div>
{engines &&
Object.entries(engines).map(([key, values]) => {
if (isLocalEngine(engines, key as InferenceEngine)) return
if (
isLocalEngine(engines, key as InferenceEngine) ||
!values.length
)
return
return (
<RemoteEngineItems
engine={key as InferenceEngine}
Expand Down
8 changes: 6 additions & 2 deletions web/screens/Settings/SettingLeftPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ const SettingLeftPanel = () => {
{engines &&
Object.entries(engines)
.filter(
([key]) => !showSettingActiveLocalEngine.includes(key)
([key]) =>
!showSettingActiveLocalEngine.includes(key) &&
engines[key as InferenceEngine].length > 0
)
.map(([key]) => {
if (!isLocalEngine(engines, key as InferenceEngine)) return
Expand Down Expand Up @@ -119,7 +121,9 @@ const SettingLeftPanel = () => {
{engines &&
Object.entries(engines)
.filter(
([key]) => !showSettingActiveRemoteEngine.includes(key)
([key]) =>
!showSettingActiveRemoteEngine.includes(key) &&
engines[key as InferenceEngine].length > 0
)
.map(([key]) => {
if (isLocalEngine(engines, key as InferenceEngine)) return
Expand Down
Loading