Russian UI: settings, notch views, agent steps, errors; visible success after installing hooks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maksarsanjeev
2026-10-06 20:15:30 +03:00
parent 750e5ad0ad
commit 319cdc8b18
20 changed files with 565 additions and 519 deletions
+15 -15
View File
@@ -226,7 +226,7 @@ final class ClaudeService {
return
}
guard let key = apiKey, !key.isEmpty else {
await showError("API key missing. Open settings.", state: state)
await showError("Нет API-ключа. Откройте Настройки.", state: state)
return
}
@@ -350,7 +350,7 @@ final class ClaudeService {
guard !baseURL.isEmpty else {
if provider.isLocal {
let name = provider == .ollama ? "Ollama" : "LM Studio"
await showError("Connect \(name) in Settings → Chat first.", state: state)
await showError("Сначала подключите \(name) в Настройки → Чат.", state: state)
}
return
}
@@ -362,7 +362,7 @@ final class ClaudeService {
authHeader = "Bearer ollama"
} else {
guard let key = KeychainStore.shared.get(provider.keychainKey), !key.isEmpty else {
await showError("\(provider.displayName) API key missing. Configure it in Settings.", state: state)
await showError("Нет API-ключа \(provider.displayName). Добавьте его в Настройки → Чат.", state: state)
return
}
authHeader = "Bearer \(key)"
@@ -463,10 +463,10 @@ final class ClaudeService {
switch e {
case .serverUnreachable:
msg = provider == .ollama
? "Ollama isn't running. Open it, then ask again."
: "Start the local server in LM Studio, then ask again."
? "Ollama не запущена. Откройте её и спросите снова."
: "Запустите локальный сервер в LM Studio и спросите снова."
case .modelNotFound(let m):
msg = "\(m) isn't installed. Pick another model above the chat box."
msg = "Модель \(m) не установлена. Выберите другую над полем чата."
case .serverError(let s):
msg = s
}
@@ -492,7 +492,7 @@ final class ClaudeService {
let choices = json["choices"] as? [[String: Any]],
let message = choices.first?["message"] as? [String: Any],
let content = message["content"] as? String else {
throw NSError(domain: "ChatAPI", code: 0, userInfo: [NSLocalizedDescriptionKey: "Unexpected response format"])
throw NSError(domain: "ChatAPI", code: 0, userInfo: [NSLocalizedDescriptionKey: "Неожиданный формат ответа"])
}
let trimmed = content.trimmingCharacters(in: .whitespacesAndNewlines)
conversationMessages.append(["role": "assistant", "content": trimmed])
@@ -511,7 +511,7 @@ final class ClaudeService {
func search(query: String, context: PromptContext?, state: AppState) async {
guard let key = apiKey, !key.isEmpty else {
await showError("Anthropic API key missing. Open settings to configure it.", state: state)
await showError("Нет API-ключа Anthropic. Добавьте его в Настройки → Чат.", state: state)
return
}
@@ -582,12 +582,12 @@ final class ClaudeService {
let id = AppState.shared.claudeModel
throw NSError(domain: "Claude", code: 0,
userInfo: [NSLocalizedDescriptionKey:
"Model not found: \(id). Pick another one in Settings."])
"Модель не найдена: \(id). Выберите другую в Настройках."])
}
throw NSError(domain: "Claude", code: 0,
userInfo: [NSLocalizedDescriptionKey: errMsg])
}
let msg = String(data: data, encoding: .utf8) ?? "unknown error"
let msg = String(data: data, encoding: .utf8) ?? "неизвестная ошибка"
throw NSError(domain: "Claude", code: 0, userInfo: [NSLocalizedDescriptionKey: msg])
}
return data
@@ -598,7 +598,7 @@ final class ClaudeService {
private func handleChatResult(_ data: Data, state: AppState) async {
guard let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
let content = json["content"] as? [[String: Any]] else {
await showError("Unexpected API response.", state: state)
await showError("Неожиданный ответ API.", state: state)
return
}
@@ -607,7 +607,7 @@ final class ClaudeService {
guard let textBlock = content.first(where: { $0["type"] as? String == "text" }),
let text = textBlock["text"] as? String, !text.isEmpty else {
await showError("No response text.", state: state)
await showError("Ответ пустой.", state: state)
return
}
@@ -627,7 +627,7 @@ final class ClaudeService {
let content = json["content"] as? [[String: Any]],
let textBlock = content.first(where: { $0["type"] as? String == "text" }),
let text = textBlock["text"] as? String else {
await showError("Unexpected API response.", state: state)
await showError("Неожиданный ответ API.", state: state)
return
}
@@ -642,7 +642,7 @@ final class ClaudeService {
// Try to parse as our JSON format
if let resultData = cleanText.data(using: .utf8),
let parsed = try? JSONSerialization.jsonObject(with: resultData) as? [String: Any] {
let title = parsed["title"] as? String ?? "Result"
let title = parsed["title"] as? String ?? "Результат"
let note = parsed["note"] as? String
var items: [ResultItem] = []
if let rawItems = parsed["items"] as? [[String: Any]] {
@@ -659,7 +659,7 @@ final class ClaudeService {
// Fallback: show raw text in 3-line chunks
let lines = cleanText.components(separatedBy: "\n").filter { !$0.isEmpty }.prefix(3)
state.searchResult = SearchResult(
title: "Claude's response",
title: "Ответ Claude",
items: lines.map { ResultItem(label: $0, detail: "", url: nil) },
note: nil
)