Added Liebranca.

This commit is contained in:
retoor 2025-02-28 21:18:55 +01:00
parent 487bf1e12c
commit 7e4ed68168
2 changed files with 98 additions and 0 deletions

37
disk_usage.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
echo "🔍 Analyzing disk usage... Please wait."
# 1. Show overall disk usage
echo -e "\n📊 Disk Usage Overview:"
df -h
# 2. Show the largest directories in /
echo -e "\n📂 Top 10 Largest Directories in Root (/):"
du -ahx / 2>/dev/null | sort -rh | head -10
# 3. Show the largest directories in /home
echo -e "\n🏠 Top 10 Largest Directories in /home:"
du -ahx /home 2>/dev/null | sort -rh | head -10
# 4. Show the largest files over 1GB
echo -e "\n📄 Top 10 Largest Files Over 1GB:"
find / -type f -size +1G -exec ls -lh {} + 2>/dev/null | sort -k5 -rh | head -10
# 5. Check system logs
echo -e "\n📝 Checking Large Log Files in /var/log:"
sudo du -sh /var/log/* 2>/dev/null | sort -rh | head -10
# 6. Find large installed packages (Debian-based)
if command -v dpkg-query &> /dev/null; then
echo -e "\n📦 Top 10 Largest Installed Packages (Debian-based):"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -rh | head -10
fi
# 7. Find large installed packages (RPM-based)
if command -v dnf &> /dev/null; then
echo -e "\n📦 Top 10 Largest Installed Packages (Fedora-based):"
dnf list installed | awk '{print $2, $1}' | sort -rh | head -10
fi
echo -e "\n✅ Disk Usage Analysis Completed!"

61
liebranca.py Normal file
View File

@ -0,0 +1,61 @@
# Written by retoor@molodetz.nl
# This script connects to a Pinecone assistant service and provides a command-line interface for user interaction. It includes functionality for creating or retrieving an assistant, handling chat messages, and uploading files to the assistant with specific metadata.
# External library used: Pinecone, along with pinecone_plugins.assistant.models.chat for handling message interactions with the assistant.
# MIT License
from pinecone import Pinecone
import os
import pathlib
import sys
from pinecone_plugins.assistant.models.chat import Message
pc = Pinecone(api_key=os.environ.get('PINECONE_API_KEY'))
ASSISTANT_NAME = "liebranca2"
def get_or_create_assistant(assistant_name):
assistant = None
try:
assistant = pc.assistant.create_assistant(
assistant_name=assistant_name,
instructions="Your data is based on someone called Liebranka. Act as Liebranka and talk like Liebranca. Respond as Liebranca would do. You also are used to be called libry.",
region="us",
timeout=30
)
except Exception as e:
assistant = pc.assistant.Assistant(assistant_name=assistant_name)
return assistant
assistant = get_or_create_assistant(ASSISTANT_NAME)
def cli():
messages = []
while True:
messages.append(Message(role="user", content=input("> ")))
resp = assistant.chat(messages=messages)
print(resp['message']['content'])
def upload(path, glob_pattern):
files = pathlib.Path(path).glob(glob_pattern)
for file in files:
try:
response = assistant.upload_file(
file_path=file.absolute(),
metadata={"document_type": "text"},
timeout=None
)
print(response)
except Exception as e:
print(e)
if "--test" in sys.argv or "train" in sys.argv:
upload("/home/retoor/projects/drstats/export", "*Liebranca*")
upload("/home/retoor/projects/drstats/export", "*mentions*")
print("Training complete.")
exit()
cli()