Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
agentchat
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李伟@五瓣科技
agentchat
Commits
27b3a0bb
Commit
27b3a0bb
authored
Jun 05, 2025
by
Wade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pg connstr param
parent
a2c8fcf8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
main.go
main.go
+17
-8
qa.go
qa.go
+2
-6
No files found.
main.go
View file @
27b3a0bb
...
@@ -97,6 +97,13 @@ Instructions:
...
@@ -97,6 +97,13 @@ Instructions:
func
main
()
{
func
main
()
{
// Define command-line flags with hardcoded values as defaults
deepseekAPIKey
:=
flag
.
String
(
"deepseek-api-key"
,
"sk-9f70df871a7c4b8aa566a3c7a0603706"
,
"DeepSeek API key"
)
milvusAddr
:=
flag
.
String
(
"milvus-addr"
,
"54.92.111.204:19530"
,
"Milvus server address"
)
graphragAddr
:=
flag
.
String
(
"graphrag-addr"
,
"54.92.111.204:5670"
,
"GraphRAG server address"
)
googleAIApiKey
:=
flag
.
String
(
"googleai-api-key"
,
"AIzaSyCoYBOmnwRWlH_-nT25lpn8pMg3T18Q0uI"
,
"Google AI API key"
)
pgConnString
:=
flag
.
String
(
"pg-conn-string"
,
"postgresql://postgres.awcfgdodiuqnlsobcivq:P99IU9NEoDRPsBfb@aws-0-ap-southeast-1.pooler.supabase.com:5432/postgres"
,
"PostgreSQL connection string"
)
debug
:=
flag
.
Bool
(
"debug"
,
false
,
"sets log level to debug"
)
debug
:=
flag
.
Bool
(
"debug"
,
false
,
"sets log level to debug"
)
flag
.
Parse
()
flag
.
Parse
()
...
@@ -119,12 +126,14 @@ func main() {
...
@@ -119,12 +126,14 @@ func main() {
},
},
}
}
// Initialize genkit with plugins using flag/env values
g
,
err
:=
genkit
.
Init
(
ctx
,
genkit
.
WithPlugins
(
g
,
err
:=
genkit
.
Init
(
ctx
,
genkit
.
WithPlugins
(
&
deepseek
.
DeepSeek
{
APIKey
:
"sk-9f70df871a7c4b8aa566a3c7a0603706"
},
&
deepseek
.
DeepSeek
{
APIKey
:
*
deepseekAPIKey
},
&
milvus
.
Milvus
{
Addr
:
"54.92.111.204:19530"
},
&
milvus
.
Milvus
{
Addr
:
*
milvusAddr
},
&
graphrag
.
GraphKnowledge
{
Addr
:
"54.92.111.204:5670"
},
&
graphrag
.
GraphKnowledge
{
Addr
:
*
graphragAddr
},
&
googlegenai
.
GoogleAI
{
APIKey
:
"AIzaSyCoYBOmnwRWlH_-nT25lpn8pMg3T18Q0uI"
},
&
googlegenai
.
GoogleAI
{
APIKey
:
*
googleAIApiKey
},
&
evaluators
.
GenkitEval
{
Metrics
:
metrics
}))
&
evaluators
.
GenkitEval
{
Metrics
:
metrics
},
))
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
()
.
Msg
(
err
.
Error
())
log
.
Fatal
()
.
Msg
(
err
.
Error
())
...
@@ -236,7 +245,7 @@ func main() {
...
@@ -236,7 +245,7 @@ func main() {
log
.
Fatal
()
.
Msg
(
err
.
Error
())
log
.
Fatal
()
.
Msg
(
err
.
Error
())
}
}
qa
,
err
:=
InitQAStore
()
qa
,
err
:=
InitQAStore
(
*
pgConnString
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
()
.
Msgf
(
"InitQAStore failed: %v"
,
err
)
log
.
Fatal
()
.
Msgf
(
"InitQAStore failed: %v"
,
err
)
}
}
...
...
qa.go
View file @
27b3a0bb
...
@@ -3,16 +3,12 @@ package main
...
@@ -3,16 +3,12 @@ package main
import
(
import
(
"context"
"context"
"database/sql"
"database/sql"
"flag"
"fmt"
"fmt"
"time"
"time"
_
"github.com/lib/pq"
_
"github.com/lib/pq"
)
)
var
(
connString
=
flag
.
String
(
"dbconn"
,
""
,
"database connection string"
)
)
type
QA
struct
{
type
QA
struct
{
ID
int64
// 主键
ID
int64
// 主键
...
@@ -49,9 +45,9 @@ func NewQAStore(db *sql.DB) QAStore {
...
@@ -49,9 +45,9 @@ func NewQAStore(db *sql.DB) QAStore {
}
}
// 初始化数据库连接并返回 QAStore
// 初始化数据库连接并返回 QAStore
func
InitQAStore
()
(
QAStore
,
error
)
{
func
InitQAStore
(
connString
string
)
(
QAStore
,
error
)
{
// Supabase 提供的连接字符串
// Supabase 提供的连接字符串
connString
:=
"postgresql://postgres.awcfgdodiuqnlsobcivq:P99IU9NEoDRPsBfb@aws-0-ap-southeast-1.pooler.supabase.com:5432/postgres"
//
connString := "postgresql://postgres.awcfgdodiuqnlsobcivq:P99IU9NEoDRPsBfb@aws-0-ap-southeast-1.pooler.supabase.com:5432/postgres"
// 打开数据库连接
// 打开数据库连接
db
,
err
:=
sql
.
Open
(
"postgres"
,
connString
)
db
,
err
:=
sql
.
Open
(
"postgres"
,
connString
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment