-
Notifications
You must be signed in to change notification settings - Fork 33
/
types.go
54 lines (44 loc) · 1.04 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package claude
import (
"fmt"
"github.com/bincooo/emit.io"
"net/http"
"sync"
)
type Chat struct {
mu sync.Mutex
opts *Options
oid string
cid string
session *emit.Session
}
type Attachment struct {
Content string `json:"extracted_content"`
FileName string `json:"file_name"`
FileSize int `json:"file_size"`
FileType string `json:"file_type"`
}
type Options struct {
Retry int // 重试次数
BotId string // slack里的claude-id
Model string // 提供两个模型:slack 、 web-claude-2
Proxies string // 本地代理
BaseURL string // 可代理转发
jar http.CookieJar
}
type PartialResponse struct {
Error error `json:"-"`
Text string `json:"text"`
RawData []byte `json:"-"`
}
type ErrorWrapper struct {
ErrorType ErrorType `json:"error"`
Detail string `json:"detail"`
}
type ErrorType struct {
Type string `json:"type"`
Message string `json:"message"`
}
func (c ErrorWrapper) Error() string {
return fmt.Sprintf("[ClaudeError::%s]%s: %s", c.ErrorType.Type, c.ErrorType.Message, c.Detail)
}