fix: 🐛 修复抽奖页面的一些bug

dev
Shawn 3 years ago
parent 8afc44f65d
commit f292f7e0cf

@ -16,7 +16,7 @@ export const GenerateScene = ({ setScene, prompts }: GenerateSceneProps) => {
if (loading) return;
console.time();
setLoading(true);
const prompt = [...PRESET_TOKENS, ...prompts].join(", ");
const prompt = [...PRESET_TOKENS, ...prompts].join(",");
generatePicture({
height: 384,
n_samples: 1,

@ -62,7 +62,7 @@ export const LotteryScene = ({ setScene, setPrompts }: LotterySceneProps) => {
const [activeTokens, setActiveTokens] = useState<ActivePromptToken[]>([]);
const [count, setCount] = useState(3);
const [pointPrompts, setPointPrompts] = useState<{[key: string]: any}>({});
const [pointPrompts, setPointPrompts] = useState<{ [key: string]: any }>({});
const [point, setPoint] = useState(20);
// 十连抽奖池
@ -108,7 +108,7 @@ export const LotteryScene = ({ setScene, setPrompts }: LotterySceneProps) => {
point: parseInt(kpoint),
prompt
}
return <Button variant={pointPrompts[attr]?.key === key ? "contained" : "outlined"} key={key} disabled={point < opt.point} onClick={() => {
return <Button variant={pointPrompts[attr]?.key === key ? "contained" : "outlined"} key={key} disabled={point < opt.point && (!pointPrompts[attr] || pointPrompts[attr].point + point < opt.point)} onClick={() => {
let p = point;
if (pointPrompts[attr]) p += pointPrompts[attr].point;
p -= opt.point;
@ -149,6 +149,7 @@ export const LotteryScene = ({ setScene, setPrompts }: LotterySceneProps) => {
<Button
variant="outlined"
onClick={() => {
setCount(3);
setActiveTokens(
randomSelectNoRepeat(LOTTERY_POOL, 10, (obj) => {
return {

@ -1,8 +1,6 @@
import { Configuration, OpenAIApi } from "openai";
const params = {
organization: "org-ew4m4pHcq5yYaTGF4VtbSMGH",
apiKey: "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",
// organization: "YOUR OWN ORGANIZATION HERE",
// apiKey: "YOUR OWN APIKEY HERE",
};

Loading…
Cancel
Save