XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/gpt4free

Update live image

4dd492cb
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

4 个文件 +22 -8
Modified docker/Dockerfile-slim +7 -6
@@ -21,9 +21,8 @@ RUN apt-get update && apt-get upgrade -y \
21 21 && apt-get clean \
22 22 && rm --recursive --force /var/lib/apt/lists/* /tmp/* /var/tmp/*
23 23
24 RUN mkdir -p $G4F_DIR && touch /var/log/cron.log
25 RUN chown "${G4F_USER_ID}:${G4F_USER_ID}" $G4F_DIR /var/log/cron.log \
26 && chmod gu+rw /var/run && chmod gu+s /usr/sbin/cron
24 RUN mkdir -p $G4F_DIR
25 RUN chown "${G4F_USER_ID}:${G4F_USER_ID}" $G4F_DIR
27 26
28 27 USER $G4F_USER_ID
29 28 WORKDIR $G4F_DIR
@@ -32,10 +31,12 @@ ENV HOME /home/$G4F_USER
32 31 ENV PATH "${HOME}/.local/bin:${PATH}"
33 32
34 33 RUN git clone https://github.com/xtekky/gpt4free.git $G4F_DIR \
35 && printf "*/15 * * * * python -m etc.tool.update\n" > cronfile && crontab cronfile \
36 && pip install --no-cache-dir -r requirements-slim.txt
34 && printf "*/15 * * * * ./docker/start.sh\n" > cronfile \
35 && printf "*/15 * * * * python -m etc.tool.update\n" >> cronfile && crontab cronfile \
36 && pip install --no-cache-dir -r requirements-min.txt
37 37 RUN git clone https://github.com/hlohaus/deepseek4free.git \
38 38 && cd deepseek4free && git checkout 21Feb \
39 39 && pip install --no-cache-dir . && cd .. && rm -rf deepseek4free
40 40
41 CMD cron && tail -f /var/log/cron.log & python -m g4f --port 8080 --debug --reload
41 USER root
42 CMD cron && su -c docker/start.sh $G4F_USER
Added docker/start.sh +2 -0
@@ -0,0 +1,2 @@
1 #!/usr/bin/env bash
2 python -m g4f --port 8080 --debug --reload
Modified g4f/Provider/PollinationsAI.py +12 -1
@@ -531,9 +531,20 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
531 531 if reasoning:
532 532 yield Reasoning(status="")
533 533 if kwargs.get("action") == "next":
534 safe_messages = []
535 for message in messages:
536 if message.get("role") == "user":
537 if isinstance(message.get("content"), str):
538 safe_messages.append({"role": "user", "content": message.get("content")})
539 elif isinstance(message.get("content"), list):
540 next_value = message.get("content").pop()
541 if isinstance(next_value, dict):
542 next_value = next_value.get("text")
543 if next_value:
544 safe_messages.append({"role": "user", "content": next_value})
534 545 data = {
535 546 "model": "openai",
536 "messages": [m for m in messages if m.get("role") == "user"] + FOLLOWUPS_DEVELOPER_MESSAGE,
547 "messages": safe_messages + FOLLOWUPS_DEVELOPER_MESSAGE,
537 548 "tool_choice": "required",
538 549 "tools": FOLLOWUPS_TOOLS
539 550 }
Modified g4f/providers/base_provider.py +1 -1
@@ -376,7 +376,7 @@ class ProviderModelMixin:
376 376 model = cls.default_model
377 377 if model in cls.model_aliases:
378 378 model = cls.model_aliases[model]
379 else:
379 if model not in cls.model_aliases.values():
380 380 if model not in cls.get_models(**kwargs) and cls.models:
381 381 raise ModelNotFoundError(f"Model not found: {model} in: {cls.__name__} Valid models: {cls.models}")
382 382 cls.last_model = model