mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-24 17:10:12 +08:00
Implement OpenAI chat completions in GO (#16177)
### What problem does this PR solve? Implement OpenAI chat completions in GO POST /api/v1/openai/<chat_id>/chat/completions OpenAI chat cli: internal/development.md ### Type of change - [x] Refactoring
This commit is contained in:
@@ -30,10 +30,18 @@ import (
|
||||
infinity "github.com/infiniflow/infinity-go-sdk"
|
||||
)
|
||||
|
||||
// infinityClient Infinity SDK client wrapper
|
||||
type infinityClient struct {
|
||||
conn *infinity.InfinityConnection
|
||||
dbName string
|
||||
|
||||
// Original URI from config, used by RunSQL to extract the host.
|
||||
hostURI string
|
||||
|
||||
// Port for psql wire-protocol listener (default 5432).
|
||||
postgresPort int
|
||||
|
||||
// JSON file (under conf/) with the field-name alias map.
|
||||
mappingFileName string
|
||||
}
|
||||
|
||||
// NewInfinityClient creates a new Infinity client using the SDK
|
||||
@@ -70,8 +78,11 @@ func NewInfinityClient(cfg *server.InfinityConfig) (*infinityClient, error) {
|
||||
}
|
||||
|
||||
client := &infinityClient{
|
||||
conn: conn,
|
||||
dbName: cfg.DBName,
|
||||
conn: conn,
|
||||
dbName: cfg.DBName,
|
||||
hostURI: cfg.URI,
|
||||
postgresPort: cfg.PostgresPort,
|
||||
mappingFileName: cfg.MappingFileName,
|
||||
}
|
||||
|
||||
return client, nil
|
||||
|
||||
Reference in New Issue
Block a user