l_ai_excel_header_match/ai.go

28 lines
916 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package l_ai_excel_header_match
import (
"context"
"encoding/json"
"gitea.cdlsxd.cn/self-tools/l_ai_excel_header_match/doubao"
"strings"
)
func ExcelMatch(ctx context.Context, matchToExcelHeader, selfExcelHeader []string, key string, model string) (result map[string]interface{}, err error) {
modelObj := doubao.NewDouBao(model, key)
text := []string{
"第一张表表头为key第二张表表头为value如果未匹配到则返回空",
"-第一个表头:[" + strings.Join(selfExcelHeader, ",") + "]",
"-第二个表头:[" + strings.Join(matchToExcelHeader, ",") + "]",
"-第一张表表头为key,第二张表表头为value,返回一个map映射的json字符串",
"-不需要其他额外的表述以及格式",
}
res, err := modelObj.GetData(ctx, doubao.Text, func(input string) (string, error) {
return input, nil
}, text...)
err = json.Unmarshal([]byte(res), &result)
return
}