aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker-compose.yaml40
-rw-r--r--main.go49
2 files changed, 54 insertions, 35 deletions
diff --git a/docker-compose.yaml b/docker-compose.yaml
index 9a923dc..a96c56b 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -23,25 +23,25 @@ services:
- ALL
environment:
- SERVER_DEPLOYMENT_TYPE=deployment
- prettier:
- build:
- context: ./prettier
- deploy:
- resources:
- limits:
- memory: 128M
- logging:
- driver: "json-file"
- options:
- max-size: "100m"
- networks:
- - millanet
- restart: unless-stopped
- cap_drop:
- - ALL
- cap_add:
- - NET_BIND_SERVICE
- ports:
- - "127.0.0.1:9001:9001"
+ # prettier:
+ # build:
+ # context: ./prettier
+ # deploy:
+ # resources:
+ # limits:
+ # memory: 128M
+ # logging:
+ # driver: "json-file"
+ # options:
+ # max-size: "100m"
+ # networks:
+ # - millanet
+ # restart: unless-stopped
+ # cap_drop:
+ # - ALL
+ # cap_add:
+ # - NET_BIND_SERVICE
+ # ports:
+ # - "127.0.0.1:9001:9001"
networks:
millanet:
diff --git a/main.go b/main.go
index 88dc33f..540e15d 100644
--- a/main.go
+++ b/main.go
@@ -224,24 +224,43 @@ func runIRC(appConfig TomlConfig, ircChan chan *girc.Client) {
}
defer response.Body.Close()
- var ollamaResponse OllamaResponse
- err = json.NewDecoder(response.Body).Decode(&ollamaResponse)
- if err != nil {
- client.Cmd.ReplyTo(event, fmt.Sprintf("error: %s", err.Error()))
+ var writer bytes.Buffer
+ if appConfig.Chat {
+ var ollamaChatResponse OllamaChatMessages
+ err = json.NewDecoder(response.Body).Decode(&ollamaChatResponse)
+ if err != nil {
+ client.Cmd.ReplyTo(event, fmt.Sprintf("error: %s", err.Error()))
+ }
- return
- }
+ err = quick.Highlight(&writer,
+ ollamaChatResponse.Messages[0].Content,
+ "markdown",
+ appConfig.ChromaFormatter,
+ appConfig.ChromaStyle)
+ if err != nil {
+ client.Cmd.ReplyTo(event, fmt.Sprintf("error: %s", err.Error()))
- var writer bytes.Buffer
- err = quick.Highlight(&writer,
- ollamaResponse.Response,
- "markdown",
- appConfig.ChromaFormatter,
- appConfig.ChromaStyle)
- if err != nil {
- client.Cmd.ReplyTo(event, fmt.Sprintf("error: %s", err.Error()))
+ return
+ }
+ } else {
+ var ollamaResponse OllamaResponse
+ err = json.NewDecoder(response.Body).Decode(&ollamaResponse)
+ if err != nil {
+ client.Cmd.ReplyTo(event, fmt.Sprintf("error: %s", err.Error()))
- return
+ return
+ }
+
+ err = quick.Highlight(&writer,
+ ollamaResponse.Response,
+ "markdown",
+ appConfig.ChromaFormatter,
+ appConfig.ChromaStyle)
+ if err != nil {
+ client.Cmd.ReplyTo(event, fmt.Sprintf("error: %s", err.Error()))
+
+ return
+ }
}
log.Println(writer.String())