Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# tools
.idea
.vscode

# local env
local.env.json
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"github-markdown-css": "^5.5.1",
"hast": "^1.0.0",
"highlight.js": "^11.9.0",
"i18next": "^23.11.2",
"i18next": "^23.11.3",
"i18next-browser-languagedetector": "^7.2.1",
"i18next-http-backend": "^2.5.1",
"postcss": "^8.4.38",
Expand Down
8 changes: 4 additions & 4 deletions src/constants/apiEndpoints.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const OPENAI_ENDPOINT = 'https://api.openai.com';
export const TTS_ENDPOINT = `${OPENAI_ENDPOINT}/v1/audio/speech`;
export const CHAT_COMPLETIONS_ENDPOINT = `${OPENAI_ENDPOINT}/v1/chat/completions`;
export const MODELS_ENDPOINT = `${OPENAI_ENDPOINT}/v1/models`;
export const OPENAI_ENDPOINT = 'https://api.deepinfra.com';
export const TTS_ENDPOINT = `${OPENAI_ENDPOINT}/v1/openai/audio/speech`;
export const CHAT_COMPLETIONS_ENDPOINT = `${OPENAI_ENDPOINT}/v1/openai/chat/completions`;
export const MODELS_ENDPOINT = `${OPENAI_ENDPOINT}/v1/openai/models`;
2 changes: 1 addition & 1 deletion src/constants/appConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const MAX_ROWS = 20;
export const MAX_TITLE_LENGTH = 128;

export const CHAT_STREAM_DEBOUNCE_TIME = 250;
export const DEFAULT_MODEL = 'gpt-4-turbo';
export const DEFAULT_MODEL = 'meta-llama/Meta-Llama-3-70B-Instruct';
export const DEFAULT_INSTRUCTIONS = 'You are a helpful assistant.';


Expand Down
2 changes: 1 addition & 1 deletion src/env.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"openapi_key": "your-api-key-here",
"default_model": "gpt-3.5-turbo",
"default_model": "meta-llama/Meta-Llama-3-70B-Instruct",
"default_system_prompt": "You are a helpful assistant."
}
2 changes: 1 addition & 1 deletion src/models/ChatCompletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface ChatMessagePart {

export interface ChatCompletionMessage {
role: Role,
content: ChatMessagePart[];
content: ChatMessagePart[] | string;
}

export interface ChatCompletionRequest {
Expand Down
17 changes: 12 additions & 5 deletions src/service/ChatService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,18 @@ export class ChatService {
});
}
});
return {
role: message.role,
content: contentParts,
};
}
return {
role: message.role,
content: contentParts,
};
else {
return {
role: message.role,
content: message.content,
};
}

});
}

Expand Down Expand Up @@ -317,7 +324,7 @@ export class ChatService {
const models: OpenAIModel[] = data.data;
// Filter, enrich with contextWindow from the imported constant, and sort
return models
.filter(model => model.id.startsWith("gpt-"))
.filter(model => model.id)
.map(model => {
const details = modelDetails[model.id] || {
contextWindowSize: 0,
Expand Down