mirror of
https://github.com/songquanpeng/one-api.git
synced 2026-03-07 04:04:25 +08:00
Compare commits
10 Commits
v0.6.11-al
...
fc7a7f685d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc7a7f685d | ||
|
|
8b8cd03e85 | ||
|
|
34dda83c04 | ||
|
|
bdb8571bdb | ||
|
|
1e330950d6 | ||
|
|
b356750bd5 | ||
|
|
1b877cbab0 | ||
|
|
fa5774c7cb | ||
|
|
b07f701261 | ||
|
|
79f4dedbf7 |
50
docker-compose-pg.yml
Normal file
50
docker-compose-pg.yml
Normal file
@@ -0,0 +1,50 @@
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
one-api:
|
||||
image: justsong/one-api:latest
|
||||
container_name: one-api
|
||||
restart: always
|
||||
command: --log-dir /app/logs
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./data/oneapi:/data
|
||||
- ./logs:/app/logs
|
||||
environment:
|
||||
# - SQL_DSN=oneapi:123456@tcp(db:3306)/one-api # 修改此行,或注释掉以使用 SQLite 作为数据库
|
||||
- SQL_DSN=postgres://oneapi:123456@db:5432/one-api
|
||||
- REDIS_CONN_STRING=redis://redis
|
||||
- SESSION_SECRET=random_string # 修改为随机字符串
|
||||
- TZ=Asia/Shanghai
|
||||
# - NODE_TYPE=slave # 多机部署时从节点取消注释该行
|
||||
# - SYNC_FREQUENCY=60 # 需要定期从数据库加载数据时取消注释该行
|
||||
# - FRONTEND_BASE_URL=https://openai.justsong.cn # 多机部署时从节点取消注释该行
|
||||
- THEME=berry # 使用berry主题,注销该行使用默认主题
|
||||
depends_on:
|
||||
- redis
|
||||
- db
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "wget -q -O - http://localhost:3000/api/status | grep -o '\"success\":\\s*true' | awk -F: '{print $2}'" ]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
redis:
|
||||
image: redis:latest
|
||||
container_name: redis
|
||||
restart: always
|
||||
|
||||
db:
|
||||
image: postgres:16.1-alpine3.19 # 数据库版本
|
||||
restart: always
|
||||
container_name: postgres # 容器名
|
||||
volumes:
|
||||
- ./data/postgres:/var/lib/postgresql/data #挂载目录,持久化存储
|
||||
ports:
|
||||
- '5432:5432'
|
||||
environment:
|
||||
POSTGRES_USER: 'oneapi'
|
||||
POSTGRES_PASSWORD: '123456' # 设置用户密码
|
||||
POSTGRES_DB: 'one-api'
|
||||
PGDATA: '/var/lib/postgresql/data/pgdata' # 设置数据目录
|
||||
@@ -19,6 +19,7 @@ services:
|
||||
# - NODE_TYPE=slave # 多机部署时从节点取消注释该行
|
||||
# - SYNC_FREQUENCY=60 # 需要定期从数据库加载数据时取消注释该行
|
||||
# - FRONTEND_BASE_URL=https://openai.justsong.cn # 多机部署时从节点取消注释该行
|
||||
- THEME=berry # 使用berry主题,注销该行使用默认主题
|
||||
depends_on:
|
||||
- redis
|
||||
- db
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
Button,
|
||||
Dropdown,
|
||||
Form,
|
||||
Input,
|
||||
Label,
|
||||
Message,
|
||||
Pagination,
|
||||
Popup,
|
||||
Table,
|
||||
} from 'semantic-ui-react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import {useTranslation} from 'react-i18next';
|
||||
import {Button, Dropdown, Form, Input, Label, Message, Pagination, Popup, Table,} from 'semantic-ui-react';
|
||||
import {Link} from 'react-router-dom';
|
||||
import {
|
||||
API,
|
||||
loadChannelModels,
|
||||
@@ -23,8 +13,8 @@ import {
|
||||
timestamp2string,
|
||||
} from '../helpers';
|
||||
|
||||
import { CHANNEL_OPTIONS, ITEMS_PER_PAGE } from '../constants';
|
||||
import { renderGroup, renderNumber } from '../helpers/render';
|
||||
import {CHANNEL_OPTIONS, ITEMS_PER_PAGE} from '../constants';
|
||||
import {renderGroup, renderNumber} from '../helpers/render';
|
||||
|
||||
function renderTimestamp(timestamp) {
|
||||
return <>{timestamp2string(timestamp)}</>;
|
||||
@@ -54,6 +44,9 @@ function renderType(type, t) {
|
||||
function renderBalance(type, balance, t) {
|
||||
switch (type) {
|
||||
case 1: // OpenAI
|
||||
if (balance === 0) {
|
||||
return <span>{t('channel.table.balance_not_supported')}</span>;
|
||||
}
|
||||
return <span>${balance.toFixed(2)}</span>;
|
||||
case 4: // CloseAI
|
||||
return <span>¥{balance.toFixed(2)}</span>;
|
||||
|
||||
Reference in New Issue
Block a user