Add project and deployment instruction (docs/DEPLOYMENT.md)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
59
scripts/fix_user_agent_aggressive.sh
Executable file
59
scripts/fix_user_agent_aggressive.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
# Агрессивное исправление бага с User-Agent в Open WebUI
|
||||
# Ищет и исправляет проблемную строку во всех возможных местах
|
||||
|
||||
echo "=== АГРЕССИВНОЕ ИСПРАВЛЕНИЕ USER-AGENT ==="
|
||||
echo ""
|
||||
|
||||
# Находим все файлы с проблемной строкой
|
||||
echo "Поиск всех файлов с проблемной строкой User-Agent..."
|
||||
PROBLEM_FILES=$(docker exec open-webui find /app/backend -name "*.py" -type f -exec grep -l "github.com/open-webui" {} \; 2>/dev/null)
|
||||
|
||||
if [ -z "$PROBLEM_FILES" ]; then
|
||||
echo "Файлы не найдены через docker exec, пробуем другой способ..."
|
||||
# Альтернативный способ - ищем через grep в контейнере
|
||||
docker exec open-webui sh -c 'find /app/backend -name "*.py" -type f | xargs grep -l "github.com/open-webui" 2>/dev/null' | while read pyfile; do
|
||||
if [ -n "$pyfile" ]; then
|
||||
echo "Исправление файла: $pyfile"
|
||||
docker exec open-webui sed -i "s/' (https:\/\/github\.com\/open-webui\/open-webui) RAG Bot'/'Open-WebUI-RAG-Bot'/g" "$pyfile"
|
||||
docker exec open-webui sed -i 's/" (https:\/\/github\.com\/open-webui\/open-webui) RAG Bot"/"Open-WebUI-RAG-Bot"/g' "$pyfile"
|
||||
docker exec open-webui sed -i "s/ (https:\/\/github\.com\/open-webui\/open-webui) RAG Bot/Open-WebUI-RAG-Bot/g" "$pyfile"
|
||||
docker exec open-webui sed -i 's/"User-Agent": " [^"]*RAG Bot"/"User-Agent": "Open-WebUI-RAG-Bot"/g' "$pyfile"
|
||||
docker exec open-webui sed -i "s/'User-Agent': ' [^']*RAG Bot'/'User-Agent': 'Open-WebUI-RAG-Bot'/g" "$pyfile"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "$PROBLEM_FILES" | while read pyfile; do
|
||||
echo "Исправление файла: $pyfile"
|
||||
docker exec open-webui sed -i "s/' (https:\/\/github\.com\/open-webui\/open-webui) RAG Bot'/'Open-WebUI-RAG-Bot'/g" "$pyfile"
|
||||
docker exec open-webui sed -i 's/" (https:\/\/github\.com\/open-webui\/open-webui) RAG Bot"/"Open-WebUI-RAG-Bot"/g' "$pyfile"
|
||||
docker exec open-webui sed -i "s/ (https:\/\/github\.com\/open-webui\/open-webui) RAG Bot/Open-WebUI-RAG-Bot/g" "$pyfile"
|
||||
docker exec open-webui sed -i 's/"User-Agent": " [^"]*RAG Bot"/"User-Agent": "Open-WebUI-RAG-Bot"/g' "$pyfile"
|
||||
docker exec open-webui sed -i "s/'User-Agent': ' [^']*RAG Bot'/'User-Agent': 'Open-WebUI-RAG-Bot'/g" "$pyfile"
|
||||
done
|
||||
fi
|
||||
|
||||
# Очищаем кеш Python
|
||||
echo ""
|
||||
echo "Очистка кеша Python..."
|
||||
docker exec open-webui find /app/backend -name "*.pyc" -delete 2>/dev/null
|
||||
docker exec open-webui find /app/backend -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
|
||||
|
||||
# Проверяем результат
|
||||
echo ""
|
||||
echo "Проверка результата..."
|
||||
RAG_BOT_COUNT=$(docker exec open-webui grep -r "github.com/open-webui.*RAG Bot" /app/backend 2>/dev/null | wc -l)
|
||||
if [ "$RAG_BOT_COUNT" -eq 0 ]; then
|
||||
echo "✓ Проблемная строка не найдена - патч применен успешно"
|
||||
else
|
||||
echo "⚠ Найдено вхождений проблемной строки: $RAG_BOT_COUNT"
|
||||
echo "Проблемные файлы:"
|
||||
docker exec open-webui grep -r "github.com/open-webui.*RAG Bot" /app/backend 2>/dev/null | cut -d: -f1 | sort -u
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Перезапуск Open WebUI..."
|
||||
docker restart open-webui
|
||||
|
||||
echo ""
|
||||
echo "Готово! Подождите 15 секунд и проверьте поиск."
|
||||
Reference in New Issue
Block a user