mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-24 13:07:53 +08:00
Update live image
This commit is contained in:
@@ -21,9 +21,8 @@ RUN apt-get update && apt-get upgrade -y \
|
||||
&& apt-get clean \
|
||||
&& rm --recursive --force /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
RUN mkdir -p $G4F_DIR && touch /var/log/cron.log
|
||||
RUN chown "${G4F_USER_ID}:${G4F_USER_ID}" $G4F_DIR /var/log/cron.log \
|
||||
&& chmod gu+rw /var/run && chmod gu+s /usr/sbin/cron
|
||||
RUN mkdir -p $G4F_DIR
|
||||
RUN chown "${G4F_USER_ID}:${G4F_USER_ID}" $G4F_DIR
|
||||
|
||||
USER $G4F_USER_ID
|
||||
WORKDIR $G4F_DIR
|
||||
@@ -32,10 +31,12 @@ ENV HOME /home/$G4F_USER
|
||||
ENV PATH "${HOME}/.local/bin:${PATH}"
|
||||
|
||||
RUN git clone https://github.com/xtekky/gpt4free.git $G4F_DIR \
|
||||
&& printf "*/15 * * * * python -m etc.tool.update\n" > cronfile && crontab cronfile \
|
||||
&& pip install --no-cache-dir -r requirements-slim.txt
|
||||
&& printf "*/15 * * * * ./docker/start.sh\n" > cronfile \
|
||||
&& printf "*/15 * * * * python -m etc.tool.update\n" >> cronfile && crontab cronfile \
|
||||
&& pip install --no-cache-dir -r requirements-min.txt
|
||||
RUN git clone https://github.com/hlohaus/deepseek4free.git \
|
||||
&& cd deepseek4free && git checkout 21Feb \
|
||||
&& pip install --no-cache-dir . && cd .. && rm -rf deepseek4free
|
||||
|
||||
CMD cron && tail -f /var/log/cron.log & python -m g4f --port 8080 --debug --reload
|
||||
USER root
|
||||
CMD cron && su -c docker/start.sh $G4F_USER
|
||||
2
docker/start.sh
Executable file
2
docker/start.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
python -m g4f --port 8080 --debug --reload
|
||||
@@ -531,9 +531,20 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
|
||||
if reasoning:
|
||||
yield Reasoning(status="")
|
||||
if kwargs.get("action") == "next":
|
||||
safe_messages = []
|
||||
for message in messages:
|
||||
if message.get("role") == "user":
|
||||
if isinstance(message.get("content"), str):
|
||||
safe_messages.append({"role": "user", "content": message.get("content")})
|
||||
elif isinstance(message.get("content"), list):
|
||||
next_value = message.get("content").pop()
|
||||
if isinstance(next_value, dict):
|
||||
next_value = next_value.get("text")
|
||||
if next_value:
|
||||
safe_messages.append({"role": "user", "content": next_value})
|
||||
data = {
|
||||
"model": "openai",
|
||||
"messages": [m for m in messages if m.get("role") == "user"] + FOLLOWUPS_DEVELOPER_MESSAGE,
|
||||
"messages": safe_messages + FOLLOWUPS_DEVELOPER_MESSAGE,
|
||||
"tool_choice": "required",
|
||||
"tools": FOLLOWUPS_TOOLS
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ class ProviderModelMixin:
|
||||
model = cls.default_model
|
||||
if model in cls.model_aliases:
|
||||
model = cls.model_aliases[model]
|
||||
else:
|
||||
if model not in cls.model_aliases.values():
|
||||
if model not in cls.get_models(**kwargs) and cls.models:
|
||||
raise ModelNotFoundError(f"Model not found: {model} in: {cls.__name__} Valid models: {cls.models}")
|
||||
cls.last_model = model
|
||||
|
||||
Reference in New Issue
Block a user