Add LLM configuration and MCP server management UI and backend functionality

- Implemented a new SPA page for LLM Bridge and MCP Server settings in `llm-config.js`.
- Added functionality for managing LLM and MCP configurations, including toggling, saving settings, and testing connections.
- Created HTTP endpoints in `llm_utils.py` for handling LLM chat, status checks, and MCP server configuration.
- Integrated model fetching from LaRuche and Ollama backends.
- Enhanced error handling and logging for better debugging and user feedback.
This commit is contained in:
infinition
2026-03-16 20:33:22 +01:00
parent aac77a3e76
commit b759ab6d4b
41 changed files with 9991 additions and 397 deletions

View File

@@ -0,0 +1,78 @@
import json
import os
# Chargement de la base US existante
with open("us.json", "r") as f:
US_BASE = json.load(f)
# Définition des différences par rapport au clavier US
# 0 = Normal, 2 = Shift, 64 = AltGr (Right Alt)
LAYOUT_DIFFS = {
"fr": {
"a": [0, 20], "A": [2, 20], "q": [0, 4], "Q": [2, 4],
"z": [0, 26], "Z": [2, 26], "w": [0, 29], "W": [2, 29],
"m": [0, 51], "M": [2, 51],
"1": [2, 30], "2": [2, 31], "3": [2, 32], "4": [2, 33], "5": [2, 34],
"6": [2, 35], "7": [2, 36], "8": [2, 37], "9": [2, 38], "0": [2, 39],
"&": [0, 30], "é": [0, 31], "\"": [0, 32], "'": [0, 33], "(": [0, 34],
"-": [0, 35], "è": [0, 36], "_": [0, 37], "ç": [0, 38], "à": [0, 39],
"~": [64, 31], "#": [64, 32], "{": [64, 33], "[": [64, 34], "|": [64, 35],
"`": [64, 36], "\\": [64, 37], "^": [0, 47], "@": [64, 39], "]": [64, 45],
"}": [64, 46], "!": [0, 56], "§": [2, 56], "": [64, 8], ")": [0, 45],
"°": [2, 45], "=": [0, 46], "+": [2, 46], "¨": [2, 47], "$": [0, 48],
"£": [2, 48], "¤": [64, 48], "*": [0, 49], "µ": [2, 49], "ù": [0, 52],
"%": [2, 52], "²": [0, 53], ",": [0, 16], "?": [2, 16], ";": [0, 54],
".": [2, 54], ":": [0, 55], "/": [2, 55], "<": [0, 100], ">": [2, 100]
},
"uk": {
"\"": [2, 31], "@": [2, 52], "£": [2, 32], "~": [0, 50],
"#": [0, 49], "\\": [0, 100], "|": [2, 100]
},
"de": {
"y": [0, 29], "Y": [2, 29], "z": [0, 28], "Z": [2, 28],
"ß": [0, 45], "?": [2, 45], "ü": [0, 47], "Ü": [2, 47],
"+": [0, 48], "*": [2, 48], "ö": [0, 51], "Ö": [2, 51],
"ä": [0, 52], "Ä": [2, 52], "#": [0, 49], "'": [2, 49],
"&": [2, 35], "/": [2, 36], "(": [2, 37], ")": [2, 38],
"=": [2, 39], "<": [0, 100], ">": [2, 100]
},
"es": {
"ñ": [0, 51], "Ñ": [2, 51], "ç": [0, 49], "Ç": [2, 49],
"'": [0, 45], "?": [2, 45], "¡": [0, 46], "¿": [2, 46],
"´": [0, 47], "¨": [2, 47], "+": [0, 48], "*": [2, 48],
"<": [0, 100], ">": [2, 100], "-": [0, 56], "_": [2, 56]
},
"it": {
"ò": [0, 51], "ç": [2, 51], "à": [0, 52], "°": [2, 52],
"ù": [0, 49], "§": [2, 49], "è": [0, 47], "é": [2, 47],
"ì": [0, 46], "^": [2, 46], "'": [0, 45], "?": [2, 45],
"+": [0, 48], "*": [2, 48], "<": [0, 100], ">": [2, 100],
"-": [0, 56], "_": [2, 56]
},
"ru": {
"й": [0, 20], "ц": [0, 26], "у": [0, 8], "к": [0, 21], "е": [0, 23],
"н": [0, 28], "г": [0, 24], "ш": [0, 12], "щ": [0, 18], "з": [0, 19],
"х": [0, 47], "ъ": [0, 48], "ф": [0, 4], "ы": [0, 22], "в": [0, 7],
"а": [0, 4], "п": [0, 10], "р": [0, 11], "о": [0, 13], "л": [0, 14],
"д": [0, 15], "ж": [0, 51], "э": [0, 52], "я": [0, 29], "ч": [0, 27],
"с": [0, 6], "м": [0, 25], "и": [0, 5], "т": [0, 17], "ь": [0, 16],
"б": [0, 54], "ю": [0, 55], "ё": [0, 53], ".": [0, 56], ",": [2, 56],
"": [2, 32], ";": [2, 33], ":": [2, 35], "?": [2, 36]
},
"zh": {} # ZH utilise exactement le layout US
}
def generate_layouts():
for lang, diff in LAYOUT_DIFFS.items():
# Copie de la base US
new_layout = dict(US_BASE)
# Application des modifications
new_layout.update(diff)
filename = f"{lang}.json"
with open(filename, "w", encoding="utf-8") as f:
json.dump(new_layout, f, indent=4, ensure_ascii=False)
print(f"Généré : {filename} ({len(new_layout)} touches)")
if __name__ == "__main__":
generate_layouts()