Skip to content

Commit

Permalink
feat: added mistral and anthropic to completion provider status
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepat0 committed Oct 9, 2024
1 parent c188673 commit 70f05ec
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const initProviderStatus = (
statusPage: string;
} => {
switch (provider) {
case 'DEFAULT':
case 'OpenAI':
return {
getStatus: async () => {
Expand All @@ -37,6 +36,34 @@ const initProviderStatus = (
},
statusPage: 'https://status.openai.com/',
};
case 'Mistral':
return {
getStatus: async () => {
const res = await fetch(
'https://status.mistral-data.com/api/v2/summary.json'
);
const data = await res.json();
const status = data.components.find(
(component: { name: string }) => component.name === 'API'
)?.status as Status;
return status ?? 'operational';
},
statusPage: 'https://status.mistral-data.com/',
};
case 'Anthropic':
return {
getStatus: async () => {
const res = await fetch(
'https://status.anthropic.com/api/v2/summary.json'
);
const data = await res.json();
const status = data.components.find(
(component: { name: string }) => component.name === 'API'
)?.status as Status;
return status ?? 'operational';
},
statusPage: 'https://status.anthropic.com/',
};
default:
return {
getStatus: async () => 'operational',
Expand All @@ -45,7 +72,10 @@ const initProviderStatus = (
}
};

const CompletionProviderStatus = ({ forceStatus, provider }: Props) => {
const CompletionProviderStatus = ({
forceStatus,
provider = 'OpenAI',
}: Props) => {
const { t } = useTranslation();
const [status, setStatus] = useState<Status>(forceStatus ?? 'operational');

Expand All @@ -58,7 +88,7 @@ const CompletionProviderStatus = ({ forceStatus, provider }: Props) => {
.getStatus()
.then(status => setStatus(status))
.catch(console.log);
}, [forceStatus, provider]);
}, [forceStatus, providerStatus]);

return status !== 'operational' ? (
<Tooltip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ exports[`renders CompletionProviderStatus errored unchanged 1`] = `
<p>
completionProviderDown
</p>
<p>
<a
href="https://status.openai.com/"
rel="noopener noreferrer"
target="_blank"
>
completionProviderCheckStatusPage
</a>
</p>
</div>
</div>
<div
Expand Down Expand Up @@ -89,6 +98,15 @@ exports[`renders CompletionProviderStatus unchanged 1`] = `
<p>
completionProviderDown
</p>
<p>
<a
href="https://status.openai.com/"
rel="noopener noreferrer"
target="_blank"
>
completionProviderCheckStatusPage
</a>
</p>
</div>
</div>
<div
Expand Down
3 changes: 1 addition & 2 deletions src/components/MemoriWidget/MemoriWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1968,10 +1968,9 @@ const MemoriWidget = ({
});
};

console.log(getAzureStyleForEmotion(emotion))
speechSynthesizer.speakSsmlAsync(`<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="https://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" xml:lang="${getCultureCodeByLanguage(
userLang
)}"><voice name="${getTTSVoice(userLang)}"> <mstts:express-as style="${getAzureStyleForEmotion(emotion)}"><s>${replaceTextWithPhonemes(
)}"><voice name="${getTTSVoice(userLang)}"><mstts:express-as style="${getAzureStyleForEmotion(emotion)}"><s>${replaceTextWithPhonemes(
escapeHTML(stripMarkdown(stripEmojis(stripOutputTags(text)))),
userLang.toLowerCase()
)}</s></mstts:express-as></voice></speak>`,
Expand Down

0 comments on commit 70f05ec

Please sign in to comment.