Skip to content

Commit 105a1c3

Browse files
authored
Merge pull request #4486 from janhq/main
chore: sync from main into dev
2 parents 9213649 + 0dd2519 commit 105a1c3

File tree

36 files changed

+217
-220
lines changed

36 files changed

+217
-220
lines changed

core/src/browser/extensions/engines/helpers/sse.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,12 @@ export function requestInference(
9191
const toParse = cachedLines + line
9292
if (!line.includes('data: [DONE]')) {
9393
const data = JSON.parse(toParse.replace('data: ', ''))
94-
if ('error' in data) {
95-
subscriber.error(data.error)
94+
if (
95+
'error' in data ||
96+
'message' in data ||
97+
'detail' in data
98+
) {
99+
subscriber.error(data.error ?? data)
96100
subscriber.complete()
97101
return
98102
}

extensions/engine-management-extension/models/anthropic.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"inference_params": {
99
"max_tokens": 4096,
1010
"temperature": 0.7,
11-
"stream": false
11+
"stream": true
1212
},
1313
"engine": "anthropic"
1414
},
@@ -21,7 +21,7 @@
2121
"inference_params": {
2222
"max_tokens": 8192,
2323
"temperature": 0.7,
24-
"stream": false
24+
"stream": true
2525
},
2626
"engine": "anthropic"
2727
},

extensions/engine-management-extension/models/martian.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Martian Model Router",
66
"version": "1.0",
77
"description": "Martian Model Router dynamically routes requests to the best LLM in real-time",
8-
"parameters": {
8+
"inference_params": {
99
"max_tokens": 4096,
1010
"temperature": 0.7,
1111
"top_p": 0.95,

extensions/engine-management-extension/models/mistral.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Mistral Small",
66
"version": "1.1",
77
"description": "Mistral Small is the ideal choice for simple tasks (Classification, Customer Support, or Text Generation) at an affordable price.",
8-
"parameters": {
8+
"inference_params": {
99
"max_tokens": 32000,
1010
"temperature": 0.7,
1111
"top_p": 0.95,
@@ -19,7 +19,7 @@
1919
"name": "Mistral Large",
2020
"version": "1.1",
2121
"description": "Mistral Large is ideal for complex tasks (Synthetic Text Generation, Code Generation, RAG, or Agents).",
22-
"parameters": {
22+
"inference_params": {
2323
"max_tokens": 32000,
2424
"temperature": 0.7,
2525
"top_p": 0.95,
@@ -33,7 +33,7 @@
3333
"name": "Mixtral 8x22B",
3434
"version": "1.1",
3535
"description": "Mixtral 8x22B is a high-performance, cost-effective model designed for complex tasks.",
36-
"parameters": {
36+
"inference_params": {
3737
"max_tokens": 32000,
3838
"temperature": 0.7,
3939
"top_p": 0.95,

extensions/engine-management-extension/models/nvidia.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Mistral 7B",
66
"version": "1.1",
77
"description": "Mistral 7B with NVIDIA",
8-
"parameters": {
8+
"inference_params": {
99
"max_tokens": 1024,
1010
"temperature": 0.3,
1111
"top_p": 1,

extensions/engine-management-extension/models/openrouter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "OpenRouter",
66
"version": "1.0",
77
"description": " OpenRouter scouts for the lowest prices and best latencies/throughputs across dozens of providers, and lets you choose how to prioritize them.",
8-
"parameters": {
8+
"inference_params": {
99
"max_tokens": 128000,
1010
"temperature": 0.7,
1111
"top_p": 0.95,

extensions/engine-management-extension/resources/anthropic.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"transform_resp": {
1717
"chat_completions": {
18-
"template": "{% if input_request.stream %} {\"object\": \"chat.completion.chunk\", \"model\": \"{{ input_request.model }}\", \"choices\": [{\"index\": 0, \"delta\": { {% if input_request.type == \"message_start\" %} \"role\": \"assistant\", \"content\": null {% else if input_request.type == \"ping\" %} \"role\": \"assistant\", \"content\": null {% else if input_request.type == \"content_block_delta\" %} \"role\": \"assistant\", \"content\": \"{{ input_request.delta.text }}\" {% else if input_request.type == \"content_block_stop\" %} \"role\": \"assistant\", \"content\": null {% else if input_request.type == \"content_block_stop\" %} \"role\": \"assistant\", \"content\": null {% endif %} }, {% if input_request.type == \"content_block_stop\" %} \"finish_reason\": \"stop\" {% else %} \"finish_reason\": null {% endif %} }]} {% else %} {\"id\": \"{{ input_request.id }}\", \"created\": null, \"object\": \"chat.completion\", \"model\": \"{{ input_request.model }}\", \"choices\": [{ \"index\": 0, \"message\": { \"role\": \"{{ input_request.role }}\", \"content\": \"{% if input_request.content and input_request.content.0.type == \"text\" %} \"{{input_request.content.0.text}}\" {% endif %}\", \"refusal\": null }, \"logprobs\": null, \"finish_reason\": \"{{ input_request.stop_reason }}\" } ], \"usage\": { \"prompt_tokens\": {{ input_request.usage.input_tokens }}, \"completion_tokens\": {{ input_request.usage.output_tokens }}, \"total_tokens\": {{ input_request.usage.input_tokens + input_request.usage.output_tokens }}, \"prompt_tokens_details\": { \"cached_tokens\": 0 }, \"completion_tokens_details\": { \"reasoning_tokens\": 0, \"accepted_prediction_tokens\": 0, \"rejected_prediction_tokens\": 0 } }, \"system_fingerprint\": \"fp_6b68a8204b\"} {% endif %}"
18+
"template": "{% if input_request.stream %} {\"object\": \"chat.completion.chunk\", \"model\": \"{{ input_request.model }}\", \"choices\": [{\"index\": 0, \"delta\": { {% if input_request.type == \"message_start\" %} \"role\": \"assistant\", \"content\": null {% else if input_request.type == \"ping\" %} \"role\": \"assistant\", \"content\": null {% else if input_request.type == \"content_block_delta\" %} \"role\": \"assistant\", \"content\": \"{{ input_request.delta.text }}\" {% else if input_request.type == \"content_block_stop\" %} \"role\": \"assistant\", \"content\": null {% else if input_request.type == \"content_block_stop\" %} \"role\": \"assistant\", \"content\": null {% endif %} }, {% if input_request.type == \"content_block_stop\" %} \"finish_reason\": \"stop\" {% else %} \"finish_reason\": null {% endif %} }]} {% else %} {\"id\": \"{{ input_request.id }}\", \"created\": null, \"object\": \"chat.completion\", \"model\": \"{{ input_request.model }}\", \"choices\": [{ \"index\": 0, \"message\": { \"role\": \"{{ input_request.role }}\", \"content\": {% if input_request.content and input_request.content.0.type == \"text\" %} \"{{input_request.content.0.text}}\" {% else %} null {% endif %}, \"refusal\": null }, \"logprobs\": null, \"finish_reason\": \"{{ input_request.stop_reason }}\" } ], \"usage\": { \"prompt_tokens\": {{ input_request.usage.input_tokens }}, \"completion_tokens\": {{ input_request.usage.output_tokens }}, \"total_tokens\": {{ input_request.usage.input_tokens + input_request.usage.output_tokens }}, \"prompt_tokens_details\": { \"cached_tokens\": 0 }, \"completion_tokens_details\": { \"reasoning_tokens\": 0, \"accepted_prediction_tokens\": 0, \"rejected_prediction_tokens\": 0 } }, \"system_fingerprint\": \"fp_6b68a8204b\"} {% endif %}"
1919
}
2020
}
2121
}

extensions/engine-management-extension/resources/mistral.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"transform_resp": {
1717
"chat_completions": {
18-
"template": "{ {% set first = true %} {% for key, value in input_request %} {% if key == \"choices\" or key == \"created\" or key == \"model\" or key == \"service_tier\" or key == \"system_fingerprint\" or key == \"stream\" or key == \"object\" or key == \"usage\" %} {% if not first %},{% endif %} \"{{ key }}\": {{ tojson(value) }} {% set first = false %} {% endif %} {% endfor %} }"
18+
"template": "{{tojson(input_request)}}"
1919
}
2020
}
2121
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.9-rc3
1+
1.0.9-rc4

web/containers/Layout/BottomPanel/SystemMonitor/TableActiveModel/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
import { Tooltip, Button, Badge } from '@janhq/joi'
22

3-
import { useAtom, useAtomValue } from 'jotai'
3+
import { useAtom } from 'jotai'
44

55
import { useActiveModel } from '@/hooks/useActiveModel'
66

7+
import { useGetEngines } from '@/hooks/useEngineManagement'
8+
79
import { toGibibytes } from '@/utils/converter'
810

911
import { isLocalEngine } from '@/utils/modelEngine'
1012

11-
import { installedEnginesAtom } from '@/helpers/atoms/Engines.atom'
1213
import { serverEnabledAtom } from '@/helpers/atoms/LocalServer.atom'
1314

1415
const TableActiveModel = () => {
1516
const { activeModel, stateModel, stopModel } = useActiveModel()
16-
const engines = useAtomValue(installedEnginesAtom)
17+
const { engines } = useGetEngines()
1718

1819
const [serverEnabled, setServerEnabled] = useAtom(serverEnabledAtom)
1920

2021
return (
2122
<div className="w-1/2">
2223
<div className="overflow-hidden border-b border-[hsla(var(--app-border))]">
2324
<table className="w-full px-8">
24-
{activeModel &&
25-
engines &&
26-
isLocalEngine(engines, activeModel.engine) ? (
25+
{activeModel && isLocalEngine(engines, activeModel.engine) ? (
2726
<tbody>
2827
<tr>
2928
<td

0 commit comments

Comments
 (0)