diff --git a/core/src/browser/extensions/engines/helpers/sse.ts b/core/src/browser/extensions/engines/helpers/sse.ts index bd9945d3cc..0842675825 100644 --- a/core/src/browser/extensions/engines/helpers/sse.ts +++ b/core/src/browser/extensions/engines/helpers/sse.ts @@ -38,7 +38,7 @@ export function requestInference( errorCode = ErrorCode.InvalidApiKey } const error = { - message: data.error?.message ?? 'Error occurred.', + message: data.error?.message ?? data.message ?? 'Error occurred.', code: errorCode, } subscriber.error(error) diff --git a/extensions/inference-cohere-extension/src/index.ts b/extensions/inference-cohere-extension/src/index.ts index dd7f033174..2615ea8932 100644 --- a/extensions/inference-cohere-extension/src/index.ts +++ b/extensions/inference-cohere-extension/src/index.ts @@ -113,6 +113,8 @@ export default class JanInferenceCohereExtension extends RemoteOAIEngine { } transformResponse = (data: any) => { - return typeof data === 'object' ? data.text : JSON.parse(data).text ?? '' + return typeof data === 'object' + ? data.text + : (JSON.parse(data.replace('data: ', '').trim()).text ?? '') } } diff --git a/extensions/inference-openai-extension/package.json b/extensions/inference-openai-extension/package.json index 50fe123493..9700383d63 100644 --- a/extensions/inference-openai-extension/package.json +++ b/extensions/inference-openai-extension/package.json @@ -1,7 +1,7 @@ { "name": "@janhq/inference-openai-extension", "productName": "OpenAI Inference Engine", - "version": "1.0.3", + "version": "1.0.4", "description": "This extension enables OpenAI chat completion API calls", "main": "dist/index.js", "module": "dist/module.js", diff --git a/extensions/inference-openai-extension/resources/models.json b/extensions/inference-openai-extension/resources/models.json index 3f41c0a7db..a34bc54604 100644 --- a/extensions/inference-openai-extension/resources/models.json +++ b/extensions/inference-openai-extension/resources/models.json @@ -99,6 +99,7 @@ "parameters": { "temperature": 1, "top_p": 1, + "stream": true, "max_tokens": 32768, "frequency_penalty": 0, "presence_penalty": 0 @@ -126,6 +127,7 @@ "temperature": 1, "top_p": 1, "max_tokens": 65536, + "stream": true, "frequency_penalty": 0, "presence_penalty": 0 }, diff --git a/extensions/inference-openai-extension/src/index.ts b/extensions/inference-openai-extension/src/index.ts index d484c8ae5e..18bc4e0aae 100644 --- a/extensions/inference-openai-extension/src/index.ts +++ b/extensions/inference-openai-extension/src/index.ts @@ -80,7 +80,6 @@ export default class JanInferenceOpenAIExtension extends RemoteOAIEngine { return { ...params, max_completion_tokens: max_tokens, - stream: false, // o1 only support stream = false } } // Pass through for non-preview models diff --git a/web/containers/ErrorMessage/index.test.tsx b/web/containers/ErrorMessage/index.test.tsx index d2ae5aa813..306a80e324 100644 --- a/web/containers/ErrorMessage/index.test.tsx +++ b/web/containers/ErrorMessage/index.test.tsx @@ -63,9 +63,6 @@ describe('ErrorMessage Component', () => { render() - expect( - screen.getByText('Apologies, something’s amiss!') - ).toBeInTheDocument() expect(screen.getByText('troubleshooting assistance')).toBeInTheDocument() }) diff --git a/web/containers/ErrorMessage/index.tsx b/web/containers/ErrorMessage/index.tsx index 18558c1d81..be26ad44a7 100644 --- a/web/containers/ErrorMessage/index.tsx +++ b/web/containers/ErrorMessage/index.tsx @@ -27,8 +27,6 @@ const ErrorMessage = ({ message }: { message: ThreadMessage }) => { const getErrorTitle = () => { switch (message.error_code) { - case ErrorCode.Unknown: - return 'Apologies, something’s amiss!' case ErrorCode.InvalidApiKey: case ErrorCode.AuthenticationError: case ErrorCode.InvalidRequestError: @@ -55,17 +53,17 @@ const ErrorMessage = ({ message }: { message: ThreadMessage }) => { ) default: return ( - <> +

{message.content[0]?.text?.value && ( )} - +

) } } return ( -
+
{message.status === MessageStatus.Error && (
{ if ( !(await extensionManager