Skip to content
Closed
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
2 changes: 1 addition & 1 deletion src/components/messageInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const MessageInput = ({
iconName="24/Send"
className="bg-secondary hover:bg-secondary-hover active:bg-secondary-press disabled:bg-secondary-disabled"
isProcessing={chatProcessing}
disabled={chatProcessing || !userMessage}
disabled={chatProcessing || !userMessage || realtimeAPIMode}
onClick={onClickSendButton}
/>
</div>
Expand Down
6 changes: 5 additions & 1 deletion src/components/settings/modelProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ const ModelProvider = () => {
isPlaying: false,
})
}

if (newService !== 'openai' && newService !== 'azure') {
settingsStore.setState({ realtimeAPIMode: false })
}
},
[]
)
Expand Down Expand Up @@ -319,7 +323,7 @@ const ModelProvider = () => {
https://RESOURCE_NAME.openai.azure.com/openai/deployments/DEPLOYMENT_NAME/chat/completions?api-version=API_VERSION
<br />
Realtime API ex.
https://RESOURCE_NAME.openai.azure.com/openai/realtime?api-version=API_VERSION&deployment=DEPLOYMENT_NAME
wss://RESOURCE_NAME.openai.azure.com/openai/realtime?api-version=API_VERSION&deployment=DEPLOYMENT_NAME
</div>
<input
className="text-ellipsis px-16 py-8 w-col-span-2 bg-surface1 hover:bg-surface1-hover rounded-8"
Expand Down
5 changes: 1 addition & 4 deletions src/components/useRealtimeAPI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,7 @@ const useRealtimeAPI = ({ handleReceiveTextFromRt }: Params) => {
'openai-beta.realtime-v1',
])
} else if (ss.selectAIService === 'azure') {
const url =
`${ss.azureEndpoint}&api-key=${ss.azureKey}` ||
`${process.env.AZURE_ENDPOINT}&api-key=${ss.azureKey}` ||
''
const url = `${ss.azureEndpoint}&api-key=${ss.azureKey}`
ws = new WebSocket(url, [])
} else {
return null
Expand Down
6 changes: 0 additions & 6 deletions src/features/chat/vercelAIChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ const getAIConfig = () => {
const apiKeyName = `${aiService}Key` as const
const apiKey = ss[apiKeyName]

if (!apiKey) {
throw new Error(
`API key for ${aiService} is missing. Unable to proceed with the AI service.`
)
}

return {
aiApiKey: apiKey,
selectAIService: aiService,
Expand Down
6 changes: 0 additions & 6 deletions src/features/slide/slideAIHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ export const judgeSlide = async (
const apiKeyName = `${aiService}Key` as const
const apiKey = ss[apiKeyName]

if (!apiKey) {
throw new Error(
`API key for ${aiService} is missing. Unable to proceed with the AI service.`
)
}

const systemMessage = `
You are an AI tasked with determining whether a user's comment is a question about a given script document and supplementary text, and if so, which page of the document is most relevant to the question. Follow these instructions carefully:

Expand Down
7 changes: 6 additions & 1 deletion src/features/stores/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,12 @@ const settingsStore = create<SettingsState>()(
process.env.NEXT_PUBLIC_CHANGE_ENGLISH_TO_JAPANESE === 'true',
showControlPanel: process.env.NEXT_PUBLIC_SHOW_CONTROL_PANEL !== 'false',
webSocketMode: process.env.NEXT_PUBLIC_WEB_SOCKET_MODE === 'true',
realtimeAPIMode: process.env.NEXT_PUBLIC_REALTIME_API_MODE === 'true',
realtimeAPIMode:
(process.env.NEXT_PUBLIC_REALTIME_API_MODE === 'true' &&
['openai', 'azure'].includes(
process.env.NEXT_PUBLIC_SELECT_AI_SERVICE as AIService
)) ||
false,
slideMode: process.env.NEXT_PUBLIC_SLIDE_MODE === 'true',
messageReceiverEnabled: false,
clientId: '',
Expand Down