You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add PostgreSQL build support in Dockerfile, similar to existing MySQL and SQLite builds.
269
269
270
-
This extension approach maintains the integrity of the existing architecture while providing flexible database support.
270
+
This extension approach maintains the integrity of the existing architecture while providing flexible database support.
271
+
272
+
### Adding New LLM Adapters (Adapters)
273
+
274
+
Adapters are responsible for handling direct communication with upstream LLM APIs, including request building, authentication, and key rotation. Core code is located in `backend/internal/adapters`.
275
+
276
+
#### 1. Define Adapter Structure
277
+
Implement the `LLMAdapter` interface:
278
+
279
+
```go
280
+
typeLLMAdapterinterface {
281
+
ProcessRequest() (*services.TargetRequest, error)
282
+
}
283
+
```
284
+
285
+
#### 2. Implement Core Logic
286
+
Embed `BaseLLMAdapter` to reuse common logic (like key rotation):
Converters are responsible for handling transformations between client-side formats and backend API expected formats. Core code is located in `backend/internal/converters`.
310
+
311
+
#### 1. Register New Format
312
+
Register the new format identifier in `backend/internal/converters/formats/registry.go`:
313
+
314
+
```go
315
+
// Example: Adding a new format identifier
316
+
const (
317
+
FormatClaudeNative = "claude_native"
318
+
)
319
+
```
320
+
321
+
#### 2. Implement Format Handler
322
+
Implement the `FormatHandler` interface in `backend/internal/converters/formats/claude_native/`:
323
+
324
+
```go
325
+
typeClaudeNativeHandlerstruct{}
326
+
327
+
// Build Request: Convert universal request format to Claude native format
If streaming support is required, implement the `StreamHandler` interface to handle SSE (Server-Sent Events) transformations. This is critical for chat interaction experiences.
340
+
341
+
```go
342
+
typeStreamHandlerinterface {
343
+
// Parse stream chunk: Parse format-specific SSE data line into universal stream chunk
0 commit comments