Skip to content

Commit

Permalink
fix: API URL end with forward slash
Browse files Browse the repository at this point in the history
  • Loading branch information
zhu-xiaowei committed Nov 15, 2024
1 parent e6e08be commit c4907ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/settings/SettingsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ function SettingsScreen(): React.JSX.Element {
<CustomHeaderRightButton
onPress={async () => {
saveKeys(apiUrl.trim(), apiKey.trim());
fetchAndSetModelNames().then();
navigation.navigate('Bedrock', {
sessionId: -1,
tapIndex: -1,
Expand Down
7 changes: 3 additions & 4 deletions src/storage/StorageUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ let currentRegion: string | undefined;
let currentImageModel: Model | undefined;
let currentTextModel: Model | undefined;

export function clearAllStorage() {
storage.clearAll();
}

export function saveMessages(sessionId: number, messages: IMessage[]) {
storage.set(sessionIdPrefix + sessionId, JSON.stringify(messages));
}
Expand Down Expand Up @@ -103,6 +99,9 @@ export function getSessionId() {

export function saveKeys(apiUrl: string, apiKey: string) {
if (apiUrl.length > 0 && apiKey.length > 0) {
if (apiUrl.endsWith('/')) {
apiUrl = apiUrl.slice(0, -1);
}
saveApiUrl(apiUrl);
saveApiKey(apiKey);
currentApiKey = apiKey;
Expand Down

0 comments on commit c4907ba

Please sign in to comment.