Skip to content

Commit 2b80b2a

Browse files
committed
fix ollama
1 parent f2eab33 commit 2b80b2a

File tree

7 files changed

+47
-7
lines changed

7 files changed

+47
-7
lines changed

libraries/ollama/models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type LocalModelDetails struct {
2828
}
2929

3030
func (c *client) ListLocalModels(ctx context.Context) ([]*LocalModel, error) {
31-
req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.endpointURL+"/models", nil)
31+
req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.endpointURL+"/api/models", nil)
3232
if err != nil {
3333
return nil, err
3434
}

services/airelay/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ This will invoke a call to an AI model, passing in a full conversation, wait for
4747

4848
```typescript
4949
interface Request {
50+
conversation_id: string;
51+
message_id: string;
5052
owner: {
5153
type: 'user';
5254
identifier: string;
@@ -78,6 +80,8 @@ This will invoke a call to an AI model, passing in a full conversation, and stre
7880

7981
```typescript
8082
interface Request {
83+
conversation_id: string;
84+
message_id: string;
8185
streaming_channel_id: string;
8286
owner: {
8387
type: 'user';

services/airelay/airelay.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ type ListSupportedResponseModel struct {
3232
}
3333

3434
type InvokeConversationMessageRequest struct {
35+
ConversationID string `json:"conversation_id"`
36+
MessageID string `json:"message_id"`
3537
Owner *Actor `json:"owner"`
3638
Messages []*InvokeConversationMessageRequestMessage `json:"messages"`
3739
AIRelayOptions *InvokeConversationMessageRequestAIRelayOptions `json:"ai_relay_options"`
@@ -52,6 +54,8 @@ type InvokeConversationMessageResponse struct {
5254
MessageContent string `json:"message_content"`
5355
}
5456
type InvokeStreamingConversationMessageRequest struct {
57+
ConversationID string `json:"conversation_id"`
58+
MessageID string `json:"message_id"`
5559
StreamingChannelID string `json:"streaming_channel_id"`
5660
Owner *Actor `json:"owner"`
5761
Messages []*InvokeConversationMessageRequestMessage `json:"messages"`

services/airelay/internal/libraries/relay/providers/ollama/ollama.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import (
55
"github.com/0xdeafcafe/bloefish/services/airelay/internal/libraries/relay"
66
)
77

8-
func NewProvider() relay.Provider {
8+
func NewProvider(
9+
ollamaClient ollamaClient.Client,
10+
) relay.Provider {
911
return &Provider{
10-
client: ollamaClient.NewClient(),
12+
client: ollamaClient,
1113
}
1214
}
1315

services/airelay/internal/service.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ package internal
33
import (
44
"context"
55

6+
ollamaClient "github.com/0xdeafcafe/bloefish/libraries/ollama"
7+
oaiClient "github.com/openai/openai-go"
8+
openaiOption "github.com/openai/openai-go/option"
9+
610
"github.com/0xdeafcafe/bloefish/libraries/clog"
711
"github.com/0xdeafcafe/bloefish/libraries/config"
812
"github.com/0xdeafcafe/bloefish/libraries/telemetry"
@@ -14,9 +18,6 @@ import (
1418
"github.com/0xdeafcafe/bloefish/services/conversation"
1519
"github.com/0xdeafcafe/bloefish/services/fileupload"
1620
"github.com/0xdeafcafe/bloefish/services/stream"
17-
18-
oaiClient "github.com/openai/openai-go"
19-
openaiOption "github.com/openai/openai-go/option"
2021
)
2122

2223
type Config struct {
@@ -118,7 +119,11 @@ func Run(ctx context.Context) error {
118119
Name: "o1 mini",
119120
}}),
120121
)),
121-
relay.WithProvider(ollama.NewProvider()),
122+
relay.WithProvider(ollama.NewProvider(
123+
ollamaClient.NewClient(
124+
ollamaClient.WithEndpointURL(cfg.AIProviders.Ollama.Endpoint),
125+
),
126+
)),
122127
),
123128

124129
ConversationService: conversation.NewRPCClient(ctx, cfg.ConversationService),

services/airelay/internal/transport/rpc/invoke_conversation_message.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,24 @@
33
"additionalProperties": false,
44

55
"required": [
6+
"conversation_id",
7+
"message_id",
68
"owner",
79
"messages",
810
"ai_relay_options"
911
],
1012

1113
"properties": {
14+
"conversation_id": {
15+
"type": "string",
16+
"minLength": 1
17+
},
18+
19+
"message_id": {
20+
"type": "string",
21+
"minLength": 1
22+
},
23+
1224
"owner": {
1325
"type": "object",
1426
"additionalProperties": false,
@@ -76,6 +88,7 @@
7688
"type": "string",
7789
"minLength": 1
7890
},
91+
7992
"model_id": {
8093
"type": "string",
8194
"minLength": 1

services/airelay/internal/transport/rpc/invoke_streaming_conversation_message.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,25 @@
33
"additionalProperties": false,
44

55
"required": [
6+
"conversation_id",
7+
"message_id",
68
"streaming_channel_id",
79
"owner",
810
"messages",
911
"ai_relay_options"
1012
],
1113

1214
"properties": {
15+
"conversation_id": {
16+
"type": "string",
17+
"minLength": 1
18+
},
19+
20+
"message_id": {
21+
"type": "string",
22+
"minLength": 1
23+
},
24+
1325
"streaming_channel_id": {
1426
"type": "string",
1527
"minLength": 1

0 commit comments

Comments
 (0)