99 "strings"
1010
1111 http "github.com/bogdanfinn/fhttp"
12+ "github.com/fatih/color"
1213
1314 "github.com/aandrew-me/tgpt/v2/src/client"
1415 "github.com/aandrew-me/tgpt/v2/src/structs"
@@ -21,19 +22,19 @@ func NewRequest(input string, params structs.Params) (*http.Response, error) {
2122 os .Exit (0 )
2223 }
2324
24- model := "deepseek-chat "
25+ model := "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B "
2526 if params .ApiModel != "" {
2627 model = params .ApiModel
2728 }
2829
2930 var data = strings .NewReader (fmt .Sprintf (`{
3031 "stream": true,
3132 "model": "%v",
32- "provider": "ollama ",
33+ "provider": "siliconflow ",
3334 "mode": "deep",
3435 "language": "all",
3536 "categories": [
36- "general "
37+ "science "
3738 ],
3839 "engine": "SEARXNG",
3940 "locally": false,
@@ -57,6 +58,7 @@ func NewRequest(input string, params structs.Params) (*http.Response, error) {
5758 req .Header .Add ("Referer" , "https://isou.chat/search" )
5859 req .Header .Add ("Content-Type" , "application/json" )
5960 req .Header .Add ("Origin" , "https://isou.chat" )
61+ req .Header .Add ("User-Agent" , "Mozilla/5.0 (X11; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0" )
6062
6163 // Return response
6264 return (client .Do (req ))
@@ -71,8 +73,16 @@ func GetMainText(line string) (mainText string) {
7173 }
7274 }
7375
76+ type Context struct {
77+ Name string `json:"name"`
78+ Source string `json:"url"`
79+ Id int `json:"id"`
80+ }
81+
7482 type InnerData struct {
75- Answer string `json:"answer"`
83+ Content string `json:"content"`
84+ ReasoningContent string `json:"reasoningContent"`
85+ Context * Context `json:"context"`
7686 }
7787
7888 type OuterData struct {
@@ -89,8 +99,23 @@ func GetMainText(line string) (mainText string) {
8999 return ""
90100 }
91101
92- if inner .Answer != "" {
93- mainText = inner .Answer
102+ italic := color .New (color .Italic )
103+ yellow := color .New (color .FgHiYellow )
104+
105+ if inner .Context != nil {
106+ mainText := yellow .Sprintf ("%v. Name: %v, Source: %v\n " , inner .Context .Id , inner .Context .Name , inner .Context .Source )
107+
108+ return mainText
109+ }
110+
111+ if inner .ReasoningContent != "" {
112+ mainText = italic .Sprint (inner .ReasoningContent )
113+
114+ return mainText
115+ }
116+
117+ if inner .Content != "" {
118+ mainText = inner .Content
94119 return mainText
95120 }
96121
0 commit comments