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