diff --git a/DEVELOPER.md b/DEVELOPER.md
index e5754210..7f62a042 100644
--- a/DEVELOPER.md
+++ b/DEVELOPER.md
@@ -1138,7 +1138,8 @@ The following are the update records for the SRS Stack server.
* Room: AI-Talk allow disable ASR/TTS, enable text. v5.13.19
* Room: AI-Talk support dictation mode. v5.13.20
* FFmpeg: Restart if time and speed abnormal. v5.13.21
- * Transcript: Fix panic bug for sync goroutines. v5.13.21
+ * Transcript: Fix panic bug for sync goroutines. [v5.13.21](https://github.com/ossrs/srs-stack/releases/tag/v5.13.21)
+ * Support OpenAI organization for billing. v5.13.22
* v5.12
* Refine local variable name conf to config. v5.12.1
* Add forced exit on timeout for program termination. v5.12.1
diff --git a/platform/ai-talk.go b/platform/ai-talk.go
index 62c30e61..9f99b776 100644
--- a/platform/ai-talk.go
+++ b/platform/ai-talk.go
@@ -171,7 +171,6 @@ func (v *openaiChatService) RequestChat(ctx context.Context, sreq *StageRequest,
system := stage.prompt
system += fmt.Sprintf(" Keep your reply neat, limiting the reply to %v words.", stage.replyLimit)
- logger.Tf(ctx, "AI system prompt: %v", system)
messages := []openai.ChatCompletionMessage{
{Role: openai.ChatMessageRoleSystem, Content: system},
}
@@ -189,8 +188,8 @@ func (v *openaiChatService) RequestChat(ctx context.Context, sreq *StageRequest,
model := stage.chatModel
maxTokens := 1024
temperature := float32(0.9)
- logger.Tf(ctx, "AIChat is OPENAI_PROXY: %v, AIT_CHAT_MODEL: %v, AIT_MAX_TOKENS: %v, AIT_TEMPERATURE: %v, window=%v, histories=%v",
- v.conf.BaseURL, model, maxTokens, temperature, stage.chatWindow, len(stage.histories))
+ logger.Tf(ctx, "AIChat is baseURL=%v, org=%v, model=%v, maxTokens=%v, temperature=%v, window=%v, histories=%v, system is %v",
+ v.conf.BaseURL, v.conf.OrgID, model, maxTokens, temperature, stage.chatWindow, len(stage.histories), system)
client := openai.NewClientWithConfig(v.conf)
gptChatStream, err := client.CreateChatCompletionStream(
@@ -973,6 +972,7 @@ func (v *Stage) UpdateFromRoom(room *SrsLiveRoom) {
// Initialize the AI services.
v.aiConfig = openai.DefaultConfig(room.AISecretKey)
+ v.aiConfig.OrgID = room.AIOrganization
v.aiConfig.BaseURL = room.AIBaseURL
// Bind stage to room.
diff --git a/platform/live-room.go b/platform/live-room.go
index 8f5df6f6..4f63dc9e 100644
--- a/platform/live-room.go
+++ b/platform/live-room.go
@@ -284,6 +284,8 @@ type SrsAssistant struct {
AIProvider string `json:"aiProvider"`
// The AI secret key.
AISecretKey string `json:"aiSecretKey"`
+ // The AI organization.
+ AIOrganization string `json:"aiOrganization"`
// The AI base URL.
AIBaseURL string `json:"aiBaseURL"`
diff --git a/platform/transcript.go b/platform/transcript.go
index 8c8c8b4f..aea971b2 100644
--- a/platform/transcript.go
+++ b/platform/transcript.go
@@ -1014,13 +1014,15 @@ type TranscriptConfig struct {
SecretKey string `json:"secretKey"`
// The base URL for AI service.
BaseURL string `json:"baseURL"`
+ // The AI organization.
+ Organization string `json:"organization"`
// The language of the stream.
Language string `json:"lang"`
}
func (v TranscriptConfig) String() string {
- return fmt.Sprintf("all=%v, key=%vB, base=%v, lang=%v",
- v.All, len(v.SecretKey), v.BaseURL, v.Language)
+ return fmt.Sprintf("all=%v, key=%vB, organization=%v, base=%v, lang=%v",
+ v.All, len(v.SecretKey), v.Organization, v.BaseURL, v.Language)
}
func (v *TranscriptConfig) Load(ctx context.Context) error {
diff --git a/scripts/setup-aapanel/info.json b/scripts/setup-aapanel/info.json
index deeea8e1..5f75ec52 100644
--- a/scripts/setup-aapanel/info.json
+++ b/scripts/setup-aapanel/info.json
@@ -1,7 +1,7 @@
{
"title": "SRS Stack",
"name": "srs_stack",
- "ps": "SRS Stack is an all-in-one, out-of-the-box, and open-source video solution for creating online video services, including live streaming and WebRTC, on the cloud or through self-hosting. Built with SRS, FFmpeg, and WebRTC, it supports various protocols and offers features like authentication, multi-platform streaming, recording, transcoding, virtual live events, transcription, automatic HTTPS, and HTTP Open API.",
+ "ps": "SRS Stack is an all-in-one, out-of-the-box, and open-source video solution for creating online video services, including live streaming and WebRTC, on the cloud or through self-hosting. Built with SRS, FFmpeg, and WebRTC, it supports various protocols and offers features like authentication, multi-platform streaming, recording, transcoding, virtual live events, transcription, AI assistant, automatic HTTPS, and HTTP Open API.",
"versions": "5.13.21",
"checks": "/www/server/panel/plugin/srs_stack",
"author": "Winlin",
diff --git a/scripts/setup-bt/info.json b/scripts/setup-bt/info.json
index 8d2b05f0..2ebcfc30 100644
--- a/scripts/setup-bt/info.json
+++ b/scripts/setup-bt/info.json
@@ -1,7 +1,7 @@
{
"title": "SRS音视频服务器",
"name": "srs_stack",
- "ps": "SRS Stack让你一键拥有自己的视频云解决方案,可以在云上或私有化部署,支持丰富的音视频协议,提供鉴权、私人直播间、多平台转播、录制、转码、虚拟直播、AI字幕、自动HTTPS、开放API等丰富功能,基于SRS、FFmpeg和WebRTC构建。",
+ "ps": "SRS Stack让你一键拥有自己的视频云解决方案,可以在云上或私有化部署,支持丰富的音视频协议,提供鉴权、私人直播间、多平台转播、录制、转码、虚拟直播、AI字幕、直播间AI助手、自动HTTPS、开放API等丰富功能,基于SRS、FFmpeg和WebRTC构建。",
"versions": "5.13.21",
"checks": "/www/server/panel/plugin/srs_stack",
"author": "Winlin",
diff --git a/ui/src/components/OpenAISettings.js b/ui/src/components/OpenAISettings.js
index 41eff27a..8f889ab0 100644
--- a/ui/src/components/OpenAISettings.js
+++ b/ui/src/components/OpenAISettings.js
@@ -5,7 +5,7 @@ import {Button, Form, Spinner} from "react-bootstrap";
import {useTranslation} from "react-i18next";
import {useErrorHandler} from "react-error-boundary";
-export function OpenAISecretSettings({baseURL, setBaseURL, secretKey, setSecretKey}) {
+export function OpenAISecretSettings({baseURL, setBaseURL, secretKey, setSecretKey, organization, setOrganization}) {
const {t} = useTranslation();
const handleError = useErrorHandler();
@@ -50,7 +50,13 @@ export function OpenAISecretSettings({baseURL, setBaseURL, secretKey, setSecretK
{t('transcript.test')}
{checking &&