semvec/pypi-packages huggingface dataset:
anychat 0.1.1
自定义ChatModel
Requires Python: >=3.12

# anychat

自定义任意 ChatModel。

## 用法

```python
from anychat import ChatModeCenter, AnyChat
from langchain_core.messages import HumanMessage, SystemMessage

# 方式一
model = AnyChat(model_name="ai-model-name", api_key="your-ai-api-key", base_url="your-ai-base-url")
messages = [SystemMessage(content="你好"), HumanMessage(content="你好")]
model.invoke(messages)

# 方式二
cmc = ChatModeCenter(api_key="your-ai-api-key", base_url="your-ai-base-url")
model = cmc.get_chat_model("ai-model-name")
model.invoke(messages)

```

## 参考

- [langchain_community/chat_models](https://github.com/langchain-ai/langchain/tree/master/libs/community/langchain_community/chat_models)
- [langchain_community/llms](https://github.com/langchain-ai/langchain/tree/master/libs/community/langchain_community/llms)
nacos-starter 1.1.0
Nacos starter for python
Requires Python: >=3.6

# nacos sdk for python

用户接入nacos，进行注册、配置获取等。基于nacos的web接口实现操作。

支持nacos版本
- 1.4
- 2.0

## 使用
### 注册到nacos
```python
from nacos_starter import Nacos

# 创建初始nacos连接对象
nacos_server = Nacos(host=NACOS_SERVER_ADDR, username=NACOS_USERNAME, password=NACOS_PASSWORD)

# 配置服务注册的参数
nacos_server.register_service(service_ip=NACOS_IP,service_port=NACOS_SERVER_PORT,service_name=SERVER_NAME)

## 如果只注册上去不想让别的服务调用，例如本地开发的时候，可以在register_service中加入enabled=False，默认会注册上去被别的服务发现

# 开启监听配置的线程和服务注册心跳进程的健康检查进程
nacos_server.healthy_check()


#### 如果在flask环境启用远程配置，建议如下用法：
flask_env = {}
# 将本地配置注入到nacos对象中即可获取远程配置，并监听配置变化实时变更
nacos_server.config(env="test",app_config=flask_env)
for item in flask_env:
  app.config[item] = flask_env[item]

"""
参数说明：
  service_ip: 本机ip，用于让其他服务调用自己，如果是docker启动或者有内外网ip需要手动指定，否则自动获取本机ip
  service_port: 指定本服务端口号
  service_name: 本服务名称，用于注册到nacos以及让其他服务调用自己
  env: 远程配置时用于区分环境，例如service-a-test.yaml，表示test环境，也可以不指定
  app_config: 用于指定要接收的配置变量，字典类型，读取的远程配置会放到这里
"""
```

### 调用其他服务
新建一个文件，例如`file_feign.py`
```python
from nacos_starter import NacosBalanceClient

# 定义失败回调
def error_fun(*args):
    for item in args:
        print(item)
    return "自定义错误"

# 新建客户端实例
nacos_client = NacosBalanceClient(host=NACOS_SERVER_ADDR,
                                       service_name="service-file", username=NACOS_USERNAME, password=NACOS_PASSWORD,
                                       timeout=3)

@nacos_client.put_mapping(url="/api/file/upload")
def upload():
    pass

@nacos_client.request_mapping(method="GET", url="/api/file/get", consumers = MediaType.APPLICATION_PROBLEM_JSON_VALUE, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
def get(type: str = 'public', fileName: str = ''):
    pass


@nacos_client.post_mapping(url="/demo/test3")
def apiTest3(formData):
    pass


@nacos_client.request_mapping(method="POST", url="/demo/test4", request_param_json=True)
def apiTest4(jsonData):
    pass

@nacos_client.request_mapping(method="GET", url="/demo/test5")
def apiTest5(*args,**kwargs):
    pass
```

使用
```python
import file_feign

file_feign.get('dns', '/a/b/c/a.png')
```

### 熔断和流控
熔断控制通过在flask接口位置加入装饰器来达到熔断，使用方法：
```python
import nacos_starter.func_fuse as funcFuse
from flask import Blueprint

SimpleFuncFuse1 = funcFuse.DegradeRule()

bp = Blueprint('api', __name__, url_prefix='/api')

@bp.route("/test1", methods=['GET'])
@SimpleFuncFuse1.hystrix(timeout=2)
def fuseTest1():#超时返回自定义超时错误返回函数
    time.sleep(3)
    return "ok"
```
### TODO
- 简化配置
- 基于flask插件快速集成
gitnote 0.1.1
AI-based Commit Generator Tool
Requires Python: <4.0,>=3.11

# gitnote ✍️

**`gitnote` is a CLI tool that uses AI to automatically generate meaningful Git commit messages based on staged changes.**

&nbsp;
&nbsp;

# Overview 🔎
`gitnote` is an intelligent CLI tool designed for automatically generating commit messages with the help of artificial intelligence. This tool analyzes the staged changes in your Git repository to assist you in writing more relevant and optimized commit messages, improving your Git workflow.



&nbsp;

# Features ✨

- **Smart Commit Message Suggestion:** Powered by Hugging Face Hub, this tool suggest commit messages tailored to your staged changes.
- **Clear and Enhanced Display:** Uses the `rich` package to beautifully render staged changes in the CLI.
- **User-Friendly CLI Interface:** Built with `typer`, `gitnote` offers an intuitive and easy-to-use command-line interface.

&nbsp;

# Installation 📥

To install `gitnote`, use pip:

```bash
pip install gitnote
```

&nbsp;

# Initial Setup ⚡

Before using `gitnote`, take your token from [Hugging Face API token](https://huggingface.co/settings/tokens) **(Recommended first!)** and run the following command to set the token :


```bash
gitnote set-token
```

You can also set the token like this :

```bash
gitnote set-token "<token>"
```
> **_Note:_** Don't forget put token inside double quotes on second way!

&nbsp;

# Usage 💡

### Available Commands

- `gitnote diff`
   Displays the staged changes in a visually enhanced format. If no changes are staged, the following message is displayed:

   ```bash
   No changes to display.
   ```

- `gitnote generate`
   Takes the staged changes (if any) and sends them to the Hugging Face Hub to generate an AI-driven commit message. If there are no staged changes, you’ll see:

   ```
   ⚠️ No staged changes found! Please make sure you've staged your changes using 'git add' and try again.
   ```

### Help Command

For a full list of commands and usage information, use:

```bash
gitnote --help
```

&nbsp;

# Dependencies 🛠️

This project is built with the following key packages:

- `typer`: For creating a command-line interface (CLI)
- `huggingface-hub`: For connecting to Hugging Face AI models to generate intelligent commit messages
- `rich`: For beautifully rendering the staged changes in the CLI

> The complete list of dependencies can be found in the `requirements.txt` file.

&nbsp;

# gitnote preview :
[gitntoe_preview](assets/preview/gitnote_preview.mp4)

# License 🧾

This project is licensed under the [MIT License](./LICENSE).