mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
Add unit tests for MessageEditorComponent, update message editing logic, and refactor ChatService model handling.
- Added comprehensive tests for `MessageEditorComponent`. - Improved message editing functionality and added client store interactions. - Refactored handling of `getSupportedModels` in `ChatService`. - Updated PWA configuration and added a Safari-specific instruction. - Adjusted `.dev.vars` file to reflect local development updates.
This commit is contained in:

committed by
Geoff Seemueller

parent
5f913eb2d7
commit
ce07b69fbe
@@ -73,14 +73,6 @@ const ChatService = types
|
||||
throw new Error('Unsupported message format');
|
||||
};
|
||||
|
||||
const getSupportedModels = async () => {
|
||||
if(self.env.OPENAI_API_ENDPOINT && self.env.OPENAI_API_ENDPOINT.includes("localhost")) {
|
||||
const openaiClient = new OpenAI({baseURL: self.env.OPENAI_API_ENDPOINT})
|
||||
const models = await openaiClient.models.list();
|
||||
return Response.json(models.data.map(model => model.id));
|
||||
}
|
||||
return Response.json(SUPPORTED_MODELS);
|
||||
};
|
||||
|
||||
const createStreamParams = async (
|
||||
streamConfig: any,
|
||||
@@ -122,7 +114,17 @@ const ChatService = types
|
||||
};
|
||||
|
||||
return {
|
||||
getSupportedModels,
|
||||
async getSupportedModels() {
|
||||
const isLocal = self.env.OPENAI_API_ENDPOINT && self.env.OPENAI_API_ENDPOINT.includes("localhost");
|
||||
console.log({isLocal})
|
||||
if(isLocal) {
|
||||
console.log("getting local models")
|
||||
const openaiClient = new OpenAI({baseURL: self.env.OPENAI_API_ENDPOINT})
|
||||
const models = await openaiClient.models.list();
|
||||
return Response.json(models.data.map(model => model.id));
|
||||
}
|
||||
return Response.json(SUPPORTED_MODELS);
|
||||
},
|
||||
setActiveStream(streamId: string, stream: any) {
|
||||
const validStream = {
|
||||
name: stream?.name || "Unnamed Stream",
|
||||
|
Reference in New Issue
Block a user