Skip to content

Commit 3bce5a8

Browse files
committed
Trim whitespaces and newlines
1 parent 80a03d0 commit 3bce5a8

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Core/Sources/HostApp/AccountSettings/APIKeyManagement/APIKeySubmission.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ struct APIKeySubmission: ReducerProtocol {
3232
guard !state.name.isEmpty else { throw E.nameIsEmpty }
3333
guard !state.key.isEmpty else { throw E.keyIsEmpty }
3434

35-
try keychain.update(state.name, key: state.key)
35+
try keychain.update(
36+
state.key,
37+
key: state.name.trimmingCharacters(in: .whitespacesAndNewlines)
38+
)
3639
return .run { send in
3740
await send(.saveFinished)
3841
}

Core/Sources/HostApp/AccountSettings/ChatModelManagement/ChatModelEdit.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ extension ChatModel {
173173
format: state.format,
174174
info: .init(
175175
apiKeyName: state.apiKeyName,
176-
baseURL: state.baseURL,
176+
baseURL: state.baseURL.trimmingCharacters(in: .whitespacesAndNewlines),
177177
maxTokens: state.maxTokens,
178178
supportsFunctionCalling: state.supportsFunctionCalling,
179-
modelName: state.modelName
179+
modelName: state.modelName.trimmingCharacters(in: .whitespacesAndNewlines)
180180
)
181181
)
182182
}

Core/Sources/HostApp/AccountSettings/EmbeddingModelManagement/EmbeddingModelEdit.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ extension EmbeddingModel {
169169
format: state.format,
170170
info: .init(
171171
apiKeyName: state.apiKeyName,
172-
baseURL: state.baseURL,
172+
baseURL: state.baseURL.trimmingCharacters(in: .whitespacesAndNewlines),
173173
maxTokens: state.maxTokens,
174-
modelName: state.modelName
174+
modelName: state.modelName.trimmingCharacters(in: .whitespacesAndNewlines)
175175
)
176176
)
177177
}

0 commit comments

Comments
 (0)