Compare commits
No commits in common. "eaa2d4ca7e6b3c3d0f5b865c1113de4728108ebc" and "203439b5641eff9c378f0f041c4a71a0931c81b9" have entirely different histories.
eaa2d4ca7e
...
203439b564
|
|
@ -60,8 +60,15 @@ default_prompt:
|
||||||
img_recognize:
|
img_recognize:
|
||||||
system_prompt:
|
system_prompt:
|
||||||
'你是一个具备图像理解与用户意图分析能力的智能助手。当用户提供一张图片时,请完成以下任务:
|
'你是一个具备图像理解与用户意图分析能力的智能助手。当用户提供一张图片时,请完成以下任务:
|
||||||
1. 关键信息提取:
|
1.图像内容识别:
|
||||||
|
识别并描述图片中的主要对象、场景、文字(如存在)、颜色、布局等基本信息。
|
||||||
|
如果图片中包含表格、图表、二维码、标志(Logo)、菜单、票据等内容,请特别指出。
|
||||||
|
2. 关键信息提取:
|
||||||
提取出图片中对用户可能有用的关键信息(例如金额、日期、标题、编号、联系信息、商品名称等)。
|
提取出图片中对用户可能有用的关键信息(例如金额、日期、标题、编号、联系信息、商品名称等)。
|
||||||
若图片为文档类(如合同、发票、收据),请结构化输出关键字段(如客户名称、金额、开票日期等)。
|
若图片为文档类(如合同、发票、收据),请结构化输出关键字段(如客户名称、金额、开票日期等)。
|
||||||
|
3.用户需求预测:
|
||||||
|
根据图片内容和常见使用场景,推测用户可能想要执行的操作或提出的问题。
|
||||||
|
例如:是否需要翻译图片中的文字?是否需要提取表格数据?是否需要分析图表趋势?是否需要识别某个标志的含义?
|
||||||
|
输出你预测的 2~3 个用户可能的需求,并简要说明理由。
|
||||||
'
|
'
|
||||||
user_prompt: '识别图片内容'
|
user_prompt: '识别图片内容, 以markdown格式输出'
|
||||||
|
|
@ -74,7 +74,7 @@ func (r *OllamaService) getPrompt(ctx context.Context, requireData *entitys.Requ
|
||||||
Content: "### 聊天记录:" + pkg.JsonStringIgonErr(buildAssistant(requireData.Histories)),
|
Content: "### 聊天记录:" + pkg.JsonStringIgonErr(buildAssistant(requireData.Histories)),
|
||||||
}, api.Message{
|
}, api.Message{
|
||||||
Role: "user",
|
Role: "user",
|
||||||
Content: r.getUserContent(requireData),
|
Content: requireData.Req.Text,
|
||||||
//Images: requireData.ImgByte,
|
//Images: requireData.ImgByte,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -94,22 +94,6 @@ func (r *OllamaService) getPrompt(ctx context.Context, requireData *entitys.Requ
|
||||||
return prompt, nil
|
return prompt, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *OllamaService) getUserContent(requireData *entitys.RequireData) string {
|
|
||||||
var content strings.Builder
|
|
||||||
content.WriteString(requireData.Req.Text)
|
|
||||||
if len(requireData.ImgByte) > 0 {
|
|
||||||
content.WriteString("\n")
|
|
||||||
content.WriteString("### 图片内容已经解析到image_desc里")
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(requireData.Req.Tags) > 0 {
|
|
||||||
content.WriteString("\n")
|
|
||||||
content.WriteString("### 工具必须使用:")
|
|
||||||
content.WriteString(requireData.Req.Tags)
|
|
||||||
}
|
|
||||||
return content.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *OllamaService) RecognizeWithImg(ctx context.Context, requireData *entitys.RequireData) (desc api.GenerateResponse, err error) {
|
func (r *OllamaService) RecognizeWithImg(ctx context.Context, requireData *entitys.RequireData) (desc api.GenerateResponse, err error) {
|
||||||
if requireData.ImgByte == nil {
|
if requireData.ImgByte == nil {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ type FirstSockRequest struct {
|
||||||
type ChatSockRequest struct {
|
type ChatSockRequest struct {
|
||||||
Text string `json:"text" binding:"required"`
|
Text string `json:"text" binding:"required"`
|
||||||
Img string `json:"img" binding:"required"`
|
Img string `json:"img" binding:"required"`
|
||||||
Tags string `json:"tags" binding:"required"`
|
|
||||||
Caller string `json:"caller" binding:"required"`
|
Caller string `json:"caller" binding:"required"`
|
||||||
SessionID string `json:"session_id"`
|
SessionID string `json:"session_id"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,11 @@ func NewNotableClient(config *config.Config) (*Client, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateRecordReq struct {
|
type UpdateRecordReq struct {
|
||||||
BaseId string
|
BaseId string
|
||||||
SheetId string
|
SheetId string
|
||||||
RecordId string
|
RecordId string
|
||||||
OperatorId string
|
UserId string
|
||||||
CreatorUnionId string
|
UnionId string
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateRecordsserResp struct {
|
type UpdateRecordsserResp struct {
|
||||||
|
|
@ -48,15 +48,11 @@ func (c *Client) UpdateRecord(accessToken string, req *UpdateRecordReq) (bool, e
|
||||||
tea.String(req.BaseId),
|
tea.String(req.BaseId),
|
||||||
tea.String(req.SheetId),
|
tea.String(req.SheetId),
|
||||||
¬able.UpdateRecordsRequest{
|
¬able.UpdateRecordsRequest{
|
||||||
OperatorId: tea.String(req.OperatorId),
|
OperatorId: tea.String(req.UnionId),
|
||||||
Records: []*notable.UpdateRecordsRequestRecords{
|
Records: []*notable.UpdateRecordsRequestRecords{
|
||||||
{
|
{
|
||||||
Fields: map[string]any{
|
Fields: map[string]interface{}{
|
||||||
"提交人": []map[string]any{
|
"提交人": req.UserId,
|
||||||
{
|
|
||||||
"unionId": req.CreatorUnionId,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Id: tea.String(req.RecordId),
|
Id: tea.String(req.RecordId),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -206,11 +206,11 @@ func (s *CallbackService) handleDingTalkCallback(c *fiber.Ctx, env Envelope) err
|
||||||
|
|
||||||
// 更新记录
|
// 更新记录
|
||||||
ok, err := s.dingtalkNotableClient.UpdateRecord(accessToken, &dingtalk_notable.UpdateRecordReq{
|
ok, err := s.dingtalkNotableClient.UpdateRecord(accessToken, &dingtalk_notable.UpdateRecordReq{
|
||||||
BaseId: data.BaseId,
|
BaseId: data.BaseId,
|
||||||
SheetId: data.SheetId,
|
SheetId: data.SheetId,
|
||||||
RecordId: data.RecordId,
|
RecordId: data.RecordId,
|
||||||
OperatorId: tools_bot.BotBugOptimizationSubmitAdminUnionId,
|
UserId: creatorId,
|
||||||
CreatorUnionId: unionId,
|
UnionId: unionId,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errorcode.ParamErr("invalid data type: %v", err)
|
return errorcode.ParamErr("invalid data type: %v", err)
|
||||||
|
|
|
||||||
|
|
@ -56,9 +56,6 @@ const (
|
||||||
// 工单QA
|
// 工单QA
|
||||||
BotBugOptimizationSubmitQA = "温子新"
|
BotBugOptimizationSubmitQA = "温子新"
|
||||||
BotBugOptimizationSubmitPM = "贺泽琨"
|
BotBugOptimizationSubmitPM = "贺泽琨"
|
||||||
|
|
||||||
// 管理员unionId - fzy
|
|
||||||
BotBugOptimizationSubmitAdminUnionId = "uoCiPKNdFmuiSFmAiiXmmiSKpQiEiE"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// 现存问题:
|
// 现存问题:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue