环境安装:
php的swoole4.8扩展、imagick软件(已安装)、php的imagick扩展(已安装)、

设置php.ini:
grpc.enable_fork_support = 1
swoole.use_shortname = off

系统字库:
cjk 中日韩英文
yum -y install google-noto-sans-thai-fonts google-noto-sans-lao-fonts google-noto-sans-khmer-fonts google-noto-sans-myanmar-fonts

php依赖库:
composer require intervention/image

样例代码:

public function svgToImg(string $svgPath, string $meetId = '000', string $outputPath = null, string $format = 'png', int $resolution = 2048)
    {
        try {
            // 优先使用 Imagick 驱动(最稳定支持 SVG)
            $manager = new ImageManager([
                'driver' => 'imagick'
            ]);

            $svgContent = file_get_contents($svgPath);
            
            $image = $manager->make($svgContent);
            
            // 处理分辨率参数(默认 2k = 2048px)
            if ($resolution !== 2048) {
                $image->resize($resolution, $resolution, function ($constraint) {
                    $constraint->aspectRatio();
                });
            }
            
            $fileName = "summary_{$meetId}_" . Str::get_random_code(5);
            // 处理默认输出路径
            if (empty($outputPath)) {
                $ext        = (in_array(strtolower($format), ['jpeg', 'jpg'])) ? 'jpg' : 'png';
                $outputPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $fileName . '.' . $ext;
            }
            
            // 确保输出目录存在
            $outputDir = dirname($outputPath);
            if (!file_exists($outputDir)) {
                mkdir($outputDir, 0755, true);
            }
            
            // 保存图片
            if (in_array(strtolower($format), ['jpeg', 'jpg'])) {
                $image->save($outputPath, 90);
            } else {
                $image->save($outputPath);
            }
            
            // 返回图片路径
            $imagePath = realpath($outputPath);
            if (!file_exists($imagePath)) {
                throw new \Exception('svgToImageV2===图片文件不存在==' . $outputPath);
            }
        
            return $imagePath;
        } catch (\Exception $e) {
            throw new \Exception("svgToImageV2===转换失败: " . $e->getMessage());
        }
    }











1、安装(官方文档):
pip install -U "langgraph-cli[inmem]"

2、创建项目骨架(交互式):
langgraph new path/to/your/app

3、安装项目依赖:
cd path/to/your/app
pip install -e .

4、配置.env文件:

# To separate your traces from other application
LANGSMITH_PROJECT=new-agent

# Add API keys for connecting to LLM providers, data sources, and other integrations here
# 要去langsmith搞个账号获取api秘钥
LANGSMITH_API_KEY=xxxxx

5、运行:
langgraph dev

注意事项:
windows环境下powershell,运行前设置

$env:PYTHONIOENCODING="utf-8"
$env:PYTHONUTF8="1"

this morning i woke up at about 9:48. because i went to bed very late last night.
i started to brush my teeth, costing me about ten minutes.After that, i took out my clothes from washing machine and hang the clothes out to dry. Today's weather seems to be a little sunny, although last night it had been raining for hours.
i bought an oatmeal bun, a red bean bun, a sesame bun and a cup of soybean milk for breakfast.
i had planed to go bike-cycling after breakfast, but when i looked at the destination listing at Amap, feeling a lost of choosing where to go.Maybe i actually didn't want to go out at all.

1、安装swag
go get -u github.com/swaggo/swag/cmd/swag
2、安装gin-swagger
go get -u github.com/swaggo/gin-swagger
go get -u github.com/swaggo/files
3、代码例子

package main

import (
   "github.com/gin-gonic/gin"
   docs "github.com/go-project-name/docs"
   swaggerfiles "github.com/swaggo/files"
   ginSwagger "github.com/swaggo/gin-swagger"
   "net/http"
)
// @BasePath /api/v1

// PingExample godoc
// @Summary ping example
// @Schemes
// @Description do ping
// @Tags example
// @Accept json
// @Produce json
// @Success 200 {string} Helloworld
// @Router /example/helloworld [get]
func Helloworld(g *gin.Context)  {
   g.JSON(http.StatusOK,"helloworld")
}

func main()  {
   r := gin.Default()
   docs.SwaggerInfo.BasePath = "/api/v1"
   v1 := r.Group("/api/v1")
   {
      eg := v1.Group("/example")
      {
         eg.GET("/helloworld",Helloworld)
      }
   }
   r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))
   r.Run(":8080")

}

4、访问地址
http://localhost:8080/swagger/index.html


生成doc文档用法(官方说明文档): 运行swag init, 默认会在main.go目录下生成docs文件夹.

swag init -h
NAME:
   swag init - Create docs.go

USAGE:
   swag init [command options] [arguments...]

OPTIONS:
   --generalInfo value, -g value          API通用信息所在的go源文件路径,如果是相对路径则基于API解析目录 (默认: "main.go")
   --dir value, -d value                  API解析目录 (默认: "./")
   --exclude value                        解析扫描时排除的目录,多个目录可用逗号分隔(默认:空)
   --propertyStrategy value, -p value     结构体字段命名规则,三种:snakecase,camelcase,pascalcase (默认: "camelcase")
   --output value, -o value               文件(swagger.json, swagger.yaml and doc.go)输出目录 (默认: "./docs")
   --parseVendor                          是否解析vendor目录里的go源文件,默认不
   --parseDependency                      是否解析依赖目录中的go源文件,默认不
   --parseDependencyLevel, --pdl          对'--parseDependency'参数进行增强, 是否解析依赖目录中的go源文件, 0 不解析, 1 只解析对象模型, 2 只解析API, 3 对象模型和API都解析 (default: 0)
   --markdownFiles value, --md value      指定API的描述信息所使用的markdown文件所在的目录
   --generatedTime                        是否输出时间到输出文件docs.go的顶部,默认是
   --codeExampleFiles value, --cef value  解析包含用于 x-codeSamples 扩展的代码示例文件的文件夹,默认禁用
   --parseInternal                        解析 internal 包中的go文件,默认禁用
   --parseDepth value                     依赖解析深度 (默认: 100)
   --instanceName value                   设置文档实例名 (默认: "swagger")

模型定义:

type TestModel struct {
    // 名称
    Name int `json:"name" example:"名称"`
}

方法定义:

// test
// @Tags test
// @Summary test
// @Description test
// @Accept application/json
// @Produce application/json
// @Param  params body TestModel true "name参数"
// @Success 200 {object} response.Response{requestId=string,code=int,data=TestModel,msg=string} "错误码10101: 系统繁忙,请稍后再试(数据处理失败); 错误码20102: 请求参数错误"
// @Router /test [post]
func (t *Test) Test(c *gin.Context) {
   // 逻辑实现...
}