Skip to content

Commit c95cecb

Browse files
committed
Refactor Dockerfile to streamline dependencies by removing unnecessary installations and update requirements.txt to exclude rocksdb-py. Enhance AI message handling by limiting history to the last 12 messages and adjust maximum tool calling rounds from 25 to 12 in ai.py.
1 parent 61099ef commit c95cecb

4 files changed

Lines changed: 9 additions & 18 deletions

File tree

Dockerfile

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
11
FROM python:3.11.3
22

3-
# System dependencies
3+
# Install Kafka
44
RUN apt-get update && apt-get install -y \
55
build-essential \
6-
clang \
7-
libclang-dev \
8-
netcat
9-
10-
# Install Kafka
11-
RUN apt-get install -y librdkafka-dev
12-
13-
# Install RocksDB
14-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
15-
. "$HOME/.cargo/env"
16-
ENV PATH="/root/.cargo/bin:${PATH}"
17-
RUN apt-get install -y software-properties-common gnupg && \
18-
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C && \
19-
apt-get update && \
20-
apt-get install -y librocksdb-dev
6+
librdkafka-dev
217

228
# Install Java
239
RUN apt-get update && \

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ asyncpg==0.29.0
1717
beautifulsoup4==4.13.3
1818
Flask-Limiter
1919
confluent-kafka==2.5.3
20-
rocksdb-py==0.0.5
2120
scapy==2.6.1
2221
SQLAlchemy==2.0.36
2322
psycopg2-binary==2.9.10

templates/pages/ai.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@
243243
append('user', text)
244244
history.push({ role: 'user', content: text })
245245

246+
// Keep only the last 12 messages.
247+
if (history.length > 12) {
248+
history = history.slice(-12)
249+
}
250+
246251
const selectedModel = modelSelect.value
247252
const message = {
248253
messages: history,

utils/ai.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ def chat(messages: List[Dict[str, str]], model: str = "openrouter/auto") -> Gene
6969

7070
conversation = [system_message] + list(messages)
7171
tools = _build_tools_schema()
72+
max_rounds = 12
7273

7374
# Maximum rounds of tool calling
74-
for round_num in range(25):
75+
for round_num in range(max_rounds):
7576
try:
7677
# Create chat completion with tools
7778
response = client.chat.completions.create(

0 commit comments

Comments
 (0)