From dc28e9187b0f94d1cad07dd8a9f0106f88fd4ec8 Mon Sep 17 00:00:00 2001 From: liangxinbing <1580466765@qq.com> Date: Sat, 8 Mar 2025 15:54:23 +0800 Subject: [PATCH] adjust code format --- .github/ISSUE_TEMPLATE/config.yaml | 2 +- .github/ISSUE_TEMPLATE/request_new_features.md | 12 ++++++------ .github/ISSUE_TEMPLATE/show_me_the_bug.md | 8 ++++---- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .github/workflows/build-package.yaml | 2 +- .github/workflows/pre-commit.yaml | 2 +- .github/workflows/stale.yaml | 2 +- .github/workflows/unittest.yaml | 2 +- README_zh.md | 4 ++-- app/config.py | 2 +- app/llm.py | 8 +++----- app/tool/file_saver.py | 2 -- config/config.example.toml | 2 +- setup.py | 3 ++- 14 files changed, 25 insertions(+), 28 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yaml b/.github/ISSUE_TEMPLATE/config.yaml index 7f86f38..892abfb 100644 --- a/.github/ISSUE_TEMPLATE/config.yaml +++ b/.github/ISSUE_TEMPLATE/config.yaml @@ -1,4 +1,4 @@ blank_issues_enabled: false contact_links: - name: "📑 Read online docs" - about: Find tutorials, use cases, and guides in the OpenManus documentation. \ No newline at end of file + about: Find tutorials, use cases, and guides in the OpenManus documentation. diff --git a/.github/ISSUE_TEMPLATE/request_new_features.md b/.github/ISSUE_TEMPLATE/request_new_features.md index a30bb81..c191adb 100644 --- a/.github/ISSUE_TEMPLATE/request_new_features.md +++ b/.github/ISSUE_TEMPLATE/request_new_features.md @@ -1,9 +1,9 @@ --- -name: "🤔 Request new features" -about: Suggest ideas or features you’d like to see implemented in OpenManus. -title: '' -labels: kind/features -assignees: '' +name: "🤔 Request new features" +about: Suggest ideas or features you’d like to see implemented in OpenManus. +title: '' +labels: kind/features +assignees: '' --- **Feature description** @@ -11,4 +11,4 @@ assignees: '' **Your Feature** - \ No newline at end of file + diff --git a/.github/ISSUE_TEMPLATE/show_me_the_bug.md b/.github/ISSUE_TEMPLATE/show_me_the_bug.md index 9748f0d..a3d8700 100644 --- a/.github/ISSUE_TEMPLATE/show_me_the_bug.md +++ b/.github/ISSUE_TEMPLATE/show_me_the_bug.md @@ -1,8 +1,8 @@ --- -name: "🪲 Show me the Bug" -about: Report a bug encountered while using OpenManus and seek assistance. +name: "🪲 Show me the Bug" +about: Report a bug encountered while using OpenManus and seek assistance. title: '' -labels: kind/bug +labels: kind/bug assignees: '' --- @@ -22,4 +22,4 @@ assignees: '' - Installation method (e.g., `pip install -r requirements.txt` or `pip install -e .`): **Screenshots or logs** - \ No newline at end of file + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d88d89a..1859f27 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -14,4 +14,4 @@ **Other** - \ No newline at end of file + diff --git a/.github/workflows/build-package.yaml b/.github/workflows/build-package.yaml index bc4be72..754c300 100644 --- a/.github/workflows/build-package.yaml +++ b/.github/workflows/build-package.yaml @@ -30,4 +30,4 @@ jobs: TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} run: | python setup.py bdist_wheel sdist - twine upload dist/* \ No newline at end of file + twine upload dist/* diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index c9824d0..944cd65 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -23,4 +23,4 @@ jobs: python -m pip install --upgrade pip pip install pre-commit black==23.1.0 isort==5.12.0 autoflake==2.0.1 - name: Run pre-commit hooks - run: pre-commit run --all-files \ No newline at end of file + run: pre-commit run --all-files diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml index edc31d9..70d8458 100644 --- a/.github/workflows/stale.yaml +++ b/.github/workflows/stale.yaml @@ -20,4 +20,4 @@ jobs: close-issue-message: "This issue was closed due to 45 days of inactivity. Reopen if still relevant." days-before-pr-stale: -1 days-before-pr-close: -1 - repo-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml index 4ed826a..cfd3b31 100644 --- a/.github/workflows/unittest.yaml +++ b/.github/workflows/unittest.yaml @@ -44,4 +44,4 @@ jobs: name: pytest-results-${{ matrix.python-version }} path: ./unittest.txt retention-days: 3 - if: ${{ always() }} \ No newline at end of file + if: ${{ always() }} diff --git a/README_zh.md b/README_zh.md index 7940301..9c8cc8f 100644 --- a/README_zh.md +++ b/README_zh.md @@ -6,7 +6,7 @@ Discord Follow

-# OpenManus 🙋 +# OpenManus 🙋 Manus 非常棒,但 OpenManus 无需邀请码即可实现任何创意 🛫! @@ -16,7 +16,7 @@ Manus 非常棒,但 OpenManus 无需邀请码即可实现任何创意 🛫! 用 OpenManus 开启你的智能体之旅吧! -## 项目演示 +## 项目演示 diff --git a/app/config.py b/app/config.py index 88a4928..540a8ac 100644 --- a/app/config.py +++ b/app/config.py @@ -24,6 +24,7 @@ class LLMSettings(BaseModel): api_type: str = Field(..., description="AzureOpenai or Openai") api_version: str = Field(..., description="Azure Openai version if AzureOpenai") + class AppConfig(BaseModel): llm: Dict[str, LLMSettings] @@ -79,7 +80,6 @@ class Config: "temperature": base_llm.get("temperature", 1.0), "api_type": base_llm.get("api_type", ""), "api_version": base_llm.get("api_version", ""), - } config_dict = { diff --git a/app/llm.py b/app/llm.py index af5d74c..8f62782 100644 --- a/app/llm.py +++ b/app/llm.py @@ -2,11 +2,11 @@ from typing import Dict, List, Literal, Optional, Union from openai import ( APIError, + AsyncAzureOpenAI, AsyncOpenAI, AuthenticationError, OpenAIError, RateLimitError, - AsyncAzureOpenAI ) from tenacity import retry, stop_after_attempt, wait_random_exponential @@ -44,12 +44,10 @@ class LLM: self.client = AsyncAzureOpenAI( base_url=self.base_url, api_key=self.api_key, - api_version=self.api_version + api_version=self.api_version, ) else: - self.client = AsyncOpenAI( - api_key=self.api_key, base_url=self.base_url - ) + self.client = AsyncOpenAI(api_key=self.api_key, base_url=self.base_url) @staticmethod def format_messages(messages: List[Union[dict, Message]]) -> List[dict]: diff --git a/app/tool/file_saver.py b/app/tool/file_saver.py index 9f4d3cb..d6a3766 100644 --- a/app/tool/file_saver.py +++ b/app/tool/file_saver.py @@ -1,4 +1,3 @@ -import asyncio import os import aiofiles @@ -58,4 +57,3 @@ The tool accepts content and a file path, and saves the content to that location return f"Content successfully saved to {file_path}" except Exception as e: return f"Error saving file: {str(e)}" - diff --git a/config/config.example.toml b/config/config.example.toml index da251f8..c1d51f0 100644 --- a/config/config.example.toml +++ b/config/config.example.toml @@ -9,7 +9,7 @@ temperature = 0.0 # [llm] #AZURE OPENAI: # api_type= 'azure' # model = "YOUR_MODEL_NAME" #"gpt-4o-mini" -# base_url = "{YOUR_AZURE_ENDPOINT.rstrip('/')}/openai/deployments/{AZURE_DEPOLYMENT_ID}" +# base_url = "{YOUR_AZURE_ENDPOINT.rstrip('/')}/openai/deployments/{AZURE_DEPOLYMENT_ID}" # api_key = "AZURE API KEY" # max_tokens = 8096 # temperature = 0.0 diff --git a/setup.py b/setup.py index b9cfb03..dd46f9c 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ -from setuptools import setup, find_packages +from setuptools import find_packages, setup + with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read()