Files

76 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Hermes Config — Правильный формат моделей
## КРИТИЧЕСКИ: DICT, не LIST
Hermes читает модели в `custom_providers` только в DICT-формате. List-формат (с `- name:`) молча игнорируется — провайдер показывает 0 моделей.
## ✅ Правильный формат (DICT)
```yaml
custom_providers:
- name: lobehub-proxy
api_key: local
provider: openai
base_url: http://localhost:20140/v1
discover_models: false
models:
claude-opus-4.8:
cost:
input: 0
output: 0
ctx: 200000
deepseek-v4-pro:
cost:
input: 0
output: 0
ctx: 131072
```
## ❌ Неправильный формат (LIST — 0 моделей в Hermes)
```yaml
models:
- name: claude-opus-4.8
context: 200000
- name: deepseek-v4-pro
context: 131072
```
## Проверка
```python
import yaml
with open(r'C:\Users\User\AppData\Local\hermes\config.yaml') as f:
c = yaml.safe_load(f)
for p in c.get('custom_providers', []):
models = p.get('models', {})
t = type(models).__name__
n = len(models)
print(f"{p.get('name')}: {t} with {n} models")
# Должно быть: dict with N models
# Если list — Hermes покажет 0
```
## Конвертация list → dict (ruamel.yaml)
```python
from ruamel.yaml import YAML
yaml = YAML()
yaml.preserve_quotes = True
with open('config.yaml') as f:
c = yaml.load(f)
for p in c['custom_providers']:
if isinstance(p.get('models'), list):
old = p['models']
new = {}
for m in old:
name = m['name']
ctx = m.get('context', 131072)
new[name] = {'cost': {'input': 0, 'output': 0}, 'ctx': ctx}
p['models'] = new
with open('config.yaml', 'w') as f:
yaml.dump(c, f)
```